Skip to content

hestudy/jsonToDartModel

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jsonToDartModel

online tool for convert json to dart code

click https://ashamp.github.io/jsonToDartModel/

Feature

  • online use, without plugin
  • surport multidimensional list
  • surport complex json
  • surpot convert all props to String type
  • empty props warning
  • single file
  • dart keyword protected
  • instant convert

FYI

  • object should have at least one property
  • only first object in array will be parsed, empty array will cause error
  • when select Force String Type , the bool type will not convert

Usage

  1. input json string in left textinput
  2. input root class name in left bottom textinput
  3. copy code by button or mouse

Example

json string may looks like

{
  "anInt": 1,
  "aDouble": 2.3,
  "aString": "hello",
  "aBool": false,
  "anObj": {
    "name": "x",
    "age": 18.0
  }
}

named it SomeRootEntity and convert to dart

  var obj = SomeRootEntity.fromJson(jsonDecode(json));
  String encodedJson = jsonEncode(obj.toJson());
  print(encodedJson);//{"anInt":1,"aDouble":2.3,"aString":"hello","aBool":false,"anObj":{"name":"x","age":18.0}}

reademe

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 68.6%
  • HTML 20.8%
  • CSS 10.6%