{"id":19346290,"url":"https://github.com/pacifio/json2dart","last_synced_at":"2026-03-11T18:35:03.719Z","repository":{"id":56833338,"uuid":"389920010","full_name":"pacifio/json2dart","owner":"pacifio","description":"A CLI tool to help generate dart classes from json returned from API","archived":false,"fork":false,"pushed_at":"2021-08-04T10:36:03.000Z","size":54887,"stargazers_count":40,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T08:23:26.339Z","etag":null,"topics":["cli","code-generation","dart","flutter","flutter-tool","json-serializer"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/json2dartc","language":"Dart","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/pacifio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-27T09:15:56.000Z","updated_at":"2024-04-07T11:35:51.000Z","dependencies_parsed_at":"2022-09-06T04:02:41.204Z","dependency_job_id":null,"html_url":"https://github.com/pacifio/json2dart","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacifio%2Fjson2dart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacifio%2Fjson2dart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacifio%2Fjson2dart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacifio%2Fjson2dart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pacifio","download_url":"https://codeload.github.com/pacifio/json2dart/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250372529,"owners_count":21419719,"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":["cli","code-generation","dart","flutter","flutter-tool","json-serializer"],"created_at":"2024-11-10T04:09:33.043Z","updated_at":"2026-03-11T18:35:03.671Z","avatar_url":"https://github.com/pacifio.png","language":"Dart","readme":"## Json 2 Dart Command line utility\n\n## Important note\n\nThere is already a package called `json2dart` so this package will be called `json2dartc` !\n\n\u003cimg src=\"./media/example.gif\" width=\"600\"\u003e\n\nThis project was made using [javiercbk's json_to_dart package](https://github.com/javiercbk/json_to_dart) ! This CLI was made to directly convert JSON stuctures into Dart classes . I personally don't like build runners and json serializers so I made this for my workflow . Feel free to open issues and submit PRs .\n\n## How to use\n\nInstall this via `pub`\n\n`pub global activate json2dartc`\n\n## Example\n\n`json2dartc -u https://reqres.in/api/users -m get -e data -n Example`\n\n## Null safety\n\nTo turn on null safe code generation , add the flag `--null-safe` , Example :\n\n`json2dartc -u https://reqres.in/api/users -m get -n Example --null-safe`\n\n## Options\n\n```\n-u, --api        API Endpoint required to grab the json from\n-e, --entry      Entry point for json data structure , e.g data.data will get the nested data array/object from API response\n-n, --name       Name of your data class\n                 (defaults to \"AutoGenerated\")\n-h, --headers    Headers for your API endpoint\n-m, --method     Method for http request , defaults to GET\n                 (defaults to \"GET\")\n```\n\n| Option | required | default         | example                     | note                                                                                                        |\n| ------ | -------- | --------------- | --------------------------- | ----------------------------------------------------------------------------------------------------------- |\n| -u     | true     | required field  | https://reqres.in/api/users |                                                                                                             |\n| -e     | false    | ''              | data                        | it's used for special access in json data , e.g data.data will access nested data object within data object |\n| -n     | false    | 'AutoGenerated' | Example                     |                                                                                                             |\n| -h     | false    | {}              | access-token=01234,foo=bar  |                                                                                                             |\n| -m     | false    | GET             | GET/POST                    |                                                                                                             |\n\n## Upcoming plans\n\n- [x] Null safety support\n- [ ] Tool itself written with null safety\n- [ ] Private memmbers option\n- [ ] Option to load json from a file\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpacifio%2Fjson2dart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpacifio%2Fjson2dart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpacifio%2Fjson2dart/lists"}