{"id":20331806,"url":"https://github.com/ztomz/json2dart","last_synced_at":"2025-07-09T11:03:14.198Z","repository":{"id":61040375,"uuid":"547830283","full_name":"zTomz/Json2Dart","owner":"zTomz","description":null,"archived":false,"fork":false,"pushed_at":"2022-10-08T11:35:35.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-22T09:42:27.467Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/zTomz.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":"2022-10-08T11:28:46.000Z","updated_at":"2022-10-08T11:28:54.000Z","dependencies_parsed_at":"2022-10-09T02:26:21.042Z","dependency_job_id":null,"html_url":"https://github.com/zTomz/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/zTomz%2FJson2Dart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zTomz%2FJson2Dart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zTomz%2FJson2Dart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zTomz%2FJson2Dart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zTomz","download_url":"https://codeload.github.com/zTomz/Json2Dart/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241847044,"owners_count":20030187,"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-14T20:23:41.238Z","updated_at":"2025-03-04T12:28:17.766Z","avatar_url":"https://github.com/zTomz.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Json2Dart\n\nJson2Dart is a package to converts your map (json) to a String, wich is the output Dart code. You can write the String to a file or put it in a text widget.\n\n## How to use\n\n```Dart\nimport 'dart:convert';\nimport 'dart:io';\n\nimport 'package:json2dart/json2dart.dart';\n\nvoid main(List\u003cString\u003e args) {\n  // Your json String\n  String jsonString = '''\n{\n    \"weather\": \"sunny\",\n    \"clouds\": \"no\",\n    \"time\": \"11.30\",\n    \"sports you can do\": [\n        \"running\",\n        \"hiking\",\n        \"biking\"\n    ],\n    \"any map\": {\n        \"key 1\": \"value 1\",\n        \"key 2\": \"value 2\"\n    }\n}''';\n\n  // Decode the json String to a Map\n  Map\u003cString, dynamic\u003e jsonData = jsonDecode(jsonString);\n\n  // Compile the json to Dart code\n  final String dartCode = Json2Dart.compileJson2Dart(jsonData, null);\n\n  // Output\n  print(\"Json:\");\n  print(jsonData);\n  print(\"\");\n  print(\"Dart:\");\n  print(dartCode);\n\n  // Or write to a file\n  File dartCodeFile = File(\"${Directory.current.path}/example/generated_json.dart\");\n  dartCodeFile.writeAsString(dartCode);\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fztomz%2Fjson2dart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fztomz%2Fjson2dart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fztomz%2Fjson2dart/lists"}