{"id":19281343,"url":"https://github.com/calavera/json_generate","last_synced_at":"2025-10-28T00:12:06.562Z","repository":{"id":25923926,"uuid":"29365047","full_name":"calavera/json_generate","owner":"calavera","description":"Generate go structs based on JSON examples","archived":false,"fork":false,"pushed_at":"2015-01-16T19:52:12.000Z","size":136,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-22T01:38:36.025Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/calavera.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-16T19:49:11.000Z","updated_at":"2015-04-26T04:09:03.000Z","dependencies_parsed_at":"2022-08-24T14:17:37.646Z","dependency_job_id":null,"html_url":"https://github.com/calavera/json_generate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/calavera/json_generate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calavera%2Fjson_generate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calavera%2Fjson_generate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calavera%2Fjson_generate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calavera%2Fjson_generate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/calavera","download_url":"https://codeload.github.com/calavera/json_generate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calavera%2Fjson_generate/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259737491,"owners_count":22903839,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T21:22:29.895Z","updated_at":"2025-10-28T00:12:06.477Z","avatar_url":"https://github.com/calavera.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSON Generate\n\nJSON Generate is a tool to create go structs based on JSON examples.\n\n## Installation\n\n```\n$ go get github.com/calavera/json_generate\n```\n\n## Usage\n\nAdd a JSON example as a constant in your go code. Something like:\n\n```go\nconst JSONExample_User = `{\n  \"name\": \"calavera\"\n}`\n```\n\nThe constant MUST have the prefix `JSONExample_` in its name.\n\nThen run the `json_generate` script with something like:\n\n```\n$ json_generate filename.go\n```\n\nOr add the `generate` header to the source file:\n\n```go\n// go:generate json_generate\n```\n\nThis will generate a `filename_json.go` file with the go struct parsed. Something like:\n\n```go\ntype User struct {\n  Name string `json:\"name,omitempty\"`\n}\n```\n\n## Options\n\n- output: Flag to specify the output where the structs are written.\n- example: Flag to limit the json examples you want to parse.\n- alias: Flag to convert inner json maps into other structs.\n- types: Flag to convert fields into specific go types.\n- debug: Print the genearted structs in STDOUT rather than into the output file.\n\n## FAQ\n\n**Is this program any good?**\n\nIt avoided me the hassle of writing a bunch of json structs by hand. It won't probably work for 100% of your use cases, but it can save you some time.\n\n**Did you spend more time working on this than it would have taken you to write those structs by hand?**\n\nDefinitely.\n\n**Did you learn something new about go by doing this rather than writing a bunch of boilerplate code?**\n\nDefinitely.\n\n## LICENSE\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalavera%2Fjson_generate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcalavera%2Fjson_generate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalavera%2Fjson_generate/lists"}