{"id":16558016,"url":"https://github.com/typ0520/jsontodartclass","last_synced_at":"2025-03-21T10:32:32.405Z","repository":{"id":206004242,"uuid":"197189339","full_name":"typ0520/JsonToDartClass","owner":"typ0520","description":"🚀Plugin for Android Studio And IntelliJ Idea to generate dart class code from JSON text ( Json to Dart )","archived":false,"fork":false,"pushed_at":"2019-07-24T13:57:54.000Z","size":141,"stargazers_count":36,"open_issues_count":8,"forks_count":11,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T00:43:31.787Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/typ0520.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-16T12:25:13.000Z","updated_at":"2022-11-13T13:07:15.000Z","dependencies_parsed_at":"2023-11-11T04:00:21.217Z","dependency_job_id":null,"html_url":"https://github.com/typ0520/JsonToDartClass","commit_stats":null,"previous_names":["typ0520/jsontodartclass"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typ0520%2FJsonToDartClass","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typ0520%2FJsonToDartClass/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typ0520%2FJsonToDartClass/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typ0520%2FJsonToDartClass/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/typ0520","download_url":"https://codeload.github.com/typ0520/JsonToDartClass/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244778047,"owners_count":20508844,"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-10-11T20:09:20.094Z","updated_at":"2025-03-21T10:32:32.399Z","avatar_url":"https://github.com/typ0520.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GitHub stars](https://img.shields.io/github/stars/typ0520/JsonToDartClass.svg?style=social\u0026label=Stars\u0026style=plastic)](https://github.com/typ0520/JsonToDartClass/stargazers)\n[![JetBrains Plugin Download](https://img.shields.io/jetbrains/plugin/d/10013-fastdex-plugin-.svg)](https://plugins.jetbrains.com/plugin/9960-JsonToDartClass)\n[![license](https://img.shields.io/github/license/typ0520/JsonToDartClass.svg)](https://github.com/typ0520/JsonToDartClass/blob/master/LICENSE)\n\n[![Dart](https://img.shields.io/badge/%20language-Flutter-red.svg)](https://flutter.dev/)\n[![IntelliJ Idea Plugin](https://img.shields.io/badge/plugin-IntelliJ%20%20Idea-blue.svg)](https://plugins.jetbrains.com/plugin/9960-JsonToDartClass)\n[![Android Studio Plugin](https://img.shields.io/badge/plugin-AndroidStudio-green.svg)](https://plugins.jetbrains.com/plugin/9960-JsonToDartClass)\n\n# JsonToDartClass\n\nHi, Welcome! This is a plugin to generate Dart `model class` from JSON string, in another word, a plugin that converts JSON string to Dart `model class` (Json to Dart)\n\n### Overview\n\nThis is a very cool tool for Flutter developers, it can convert a JSON string to Dart `model class`. The tool could not only recognize the primitive types but also auto create complex types. It's easily accessible, we provide shortcut keymap `ALT + L` for Windows and `Option + L` for Mac, have a try and you'll fall in love with it! JsonToDartClass just makes programming more enjoyable, enjoy coding!\n\n### Easy Use\n![alt text](https://plugins.jetbrains.com/files/12737/screenshot_20027.png)\n\n### Usage\n* Search 'JsonToDartClass' in Intellij Idea Plugin Repository Or AndroidStudio Plugin Repository And Install it.\n\n\u003e File --\u003e Settings --\u003e Plugins --\u003e Marketplace --\u003e Search JsonToDartClass\n\n* Restart your IDE\n\n* Press `ALT + L` for Windows or `Option + L` for Mac or right click on package -\u003e `New`-\u003e`Dart class file from JSON` and continue as guided.\n\n### Advanced usage\nHave a try with the advanced dialog :stuck_out_tongue_winking_eye:\n\n### Features\n* Generating Dart data class from any legal JSON string or any **URLs that returns a JSON string as response** or **local file that contains JSON string**\n* Generating Dart data class from any legal JSON text when right click on directory and select `New` -\u003e `Dart class File from JSON`\n* Formatting any legal JSON string\n\n### Generate Example\nThis is the example JSON from json.org\n\n\n```json\n{\n    \"glossary\":{\n        \"title\":\"example glossary\",\n        \"GlossDiv\":{\n            \"title\":\"S\",\n            \"GlossList\":{\n                \"GlossEntry\":{\n                    \"ID\":\"SGML\",\n                    \"SortAs\":\"SGML\",\n                    \"GlossTerm\":\"Standard Generalized Markup Language\",\n                    \"Acronym\":\"SGML\",\n                    \"Abbrev\":\"ISO 8879:1986\",\n                    \"GlossDef\":{\n                        \"para\":\"A meta-markup language, used to create markup languages such as DocBook.\",\n                        \"GlossSeeAlso\":[\n                            \"GML\",\n                            \"XML\"\n                        ]\n                    },\n                    \"GlossSee\":\"markup\"\n                }\n            }\n        }\n    }\n}\n```\nAnd with this plugin converting, Dart classes would generate like this by default\n\n```dart\nclass Example {\n    Glossary glossary;\n\n    Example({this.glossary});\n\n    factory Example.fromJson(Map\u003cString, dynamic\u003e json) {\n        return Example(\n            glossary: json['glossary'] != null ? Glossary.fromJson(json['glossary']) : null,\n        );\n    }\n\n    Map\u003cString, dynamic\u003e toJson() {\n        final Map\u003cString, dynamic\u003e data = new Map\u003cString, dynamic\u003e();\n        if (this.glossary != null) {\n            data['glossary'] = this.glossary.toJson();\n        }\n        return data;\n    }\n}\n\nclass Glossary {\n    GlossDiv glossDiv;\n    String title;\n\n    Glossary({this.glossDiv, this.title});\n\n    factory Glossary.fromJson(Map\u003cString, dynamic\u003e json) {\n        return Glossary(\n            glossDiv: json['glossDiv'] != null ? GlossDiv.fromJson(json['glossDiv']) : null,\n            title: json['title'],\n        );\n    }\n\n    Map\u003cString, dynamic\u003e toJson() {\n        final Map\u003cString, dynamic\u003e data = new Map\u003cString, dynamic\u003e();\n        data['title'] = this.title;\n        if (this.glossDiv != null) {\n            data['glossDiv'] = this.glossDiv.toJson();\n        }\n        return data;\n    }\n}\n\nclass GlossDiv {\n    GlossList glossList;\n    String title;\n\n    GlossDiv({this.glossList, this.title});\n\n    factory GlossDiv.fromJson(Map\u003cString, dynamic\u003e json) {\n        return GlossDiv(\n            glossList: json['glossList'] != null ? GlossList.fromJson(json['glossList']) : null,\n            title: json['title'],\n        );\n    }\n\n    Map\u003cString, dynamic\u003e toJson() {\n        final Map\u003cString, dynamic\u003e data = new Map\u003cString, dynamic\u003e();\n        data['title'] = this.title;\n        if (this.glossList != null) {\n            data['glossList'] = this.glossList.toJson();\n        }\n        return data;\n    }\n}\n\nclass GlossList {\n    GlossEntry glossEntry;\n\n    GlossList({this.glossEntry});\n\n    factory GlossList.fromJson(Map\u003cString, dynamic\u003e json) {\n        return GlossList(\n            glossEntry: json['glossEntry'] != null ? GlossEntry.fromJson(json['glossEntry']) : null,\n        );\n    }\n\n    Map\u003cString, dynamic\u003e toJson() {\n        final Map\u003cString, dynamic\u003e data = new Map\u003cString, dynamic\u003e();\n        if (this.glossEntry != null) {\n            data['glossEntry'] = this.glossEntry.toJson();\n        }\n        return data;\n    }\n}\n\nclass GlossEntry {\n    String abbrev;\n    String acronym;\n    GlossDef glossDef;\n    String glossSee;\n    String glossTerm;\n    String iD;\n    String sortAs;\n\n    GlossEntry({this.abbrev, this.acronym, this.glossDef, this.glossSee, this.glossTerm, this.iD, this.sortAs});\n\n    factory GlossEntry.fromJson(Map\u003cString, dynamic\u003e json) {\n        return GlossEntry(\n            abbrev: json['abbrev'],\n            acronym: json['acronym'],\n            glossDef: json['glossDef'] != null ? GlossDef.fromJson(json['glossDef']) : null,\n            glossSee: json['glossSee'],\n            glossTerm: json['glossTerm'],\n            iD: json['iD'],\n            sortAs: json['sortAs'],\n        );\n    }\n\n    Map\u003cString, dynamic\u003e toJson() {\n        final Map\u003cString, dynamic\u003e data = new Map\u003cString, dynamic\u003e();\n        data['abbrev'] = this.abbrev;\n        data['acronym'] = this.acronym;\n        data['glossSee'] = this.glossSee;\n        data['glossTerm'] = this.glossTerm;\n        data['iD'] = this.iD;\n        data['sortAs'] = this.sortAs;\n        if (this.glossDef != null) {\n            data['glossDef'] = this.glossDef.toJson();\n        }\n        return data;\n    }\n}\n\nclass GlossDef {\n    List\u003cString\u003e glossSeeAlso;\n    String para;\n\n    GlossDef({this.glossSeeAlso, this.para});\n\n    factory GlossDef.fromJson(Map\u003cString, dynamic\u003e json) {\n        return GlossDef(\n            glossSeeAlso: json['glossSeeAlso'] != null ? new List\u003cString\u003e.from(json['glossSeeAlso']) : null,\n            para: json['para'],\n        );\n    }\n\n    Map\u003cString, dynamic\u003e toJson() {\n        final Map\u003cString, dynamic\u003e data = new Map\u003cString, dynamic\u003e();\n        data['para'] = this.para;\n        if (this.glossSeeAlso != null) {\n            data['glossSeeAlso'] = this.glossSeeAlso;\n        }\n        return data;\n    }\n}\n```\n\n### Build From Source\n\nWant to try out the newest features?\n\n```shell\n$ git clone https://github.com/typ0520/JsonToDartClass\n$ cd JsonToDartClass\n$ ./gradlew buildPlugin\n```\n\nAnd you're done! Go to directory `build/distributions` and you'll find `JsonToDartClass-x.x.zip`, which can be installed via **Install plugin from disk...**.\n\n### Contribute to This Repo\n\nFind it useful and want to contribute? All sorts of contributions are welcome, including but not limited to:\n\n- Open an issue [here](https://github.com/typ0520/JsonToDartClass/issues) if you find a bug;\n\n- Help test the EAP version and report bugs:\n\nGo to the \"Plugins\" settings, click \"Browse repositories...\" =\u003e \"Manage repositories...\" and click the \"+\" button to add the EAP channel repository URL \"https://plugins.jetbrains.com/plugins/eap/list\". Optionally, you can also add the Alpha and Beta channel repository URLs \"https://plugins.jetbrains.com/plugins/alpha/list\" and \"https://plugins.jetbrains.com/plugins/beta/list\".\n\n\u003e Kindly note that the \"EAP\" or \"Alpha\" or \"Beta\" channel update may be unstable and tend to be buggy, if you want to get back to the stable version, remove the \"EAP\" or \"Alpha\" or \"Beta\" version and reinstall this plugin from the \"JetBrains Plugin Repository\" channel, which can be filtered by the drop-down menu next to the search input field.\n\n- Contribute your code:\n\n```shell\n$ git clone https://github.com/typ0520/JsonToDartClass\n$ cd JsonToDartClass\n```\n\nOpen the `build.gradle` in IntelliJ, open \"Gradle\" tool window, expand the project view to \"JsonToDartClass | Tasks | intellij | runIde\", right-click and choose \"Debug ...\", and you're done! Create your PR [here](https://github.com/typ0520/JsonToDartClass/pulls)!\n\n### Others\n* Any kind of issues are welcome.\n* Pull Requests are highly appreciated.\n\n### Find it useful ? :heart:\n* Support and encourage me by clicking the :star: button on the upper right of this page. :v:\n* Share to others to help more people have a better develope expierience :heart:\n\n### Thanks\n* [@JsonToKotlinClass](https://github.com/wuseal/JsonToKotlinClass) Most of the code comes from this library\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyp0520%2Fjsontodartclass","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftyp0520%2Fjsontodartclass","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyp0520%2Fjsontodartclass/lists"}