json_dart_generator 1.1.0+1 copy "json_dart_generator: ^1.1.0+1" to clipboard
json_dart_generator: ^1.1.0+1 copied to clipboard

Convert json data to dart class, Support multiple formats(root is array / multiple array etc).

example/example.dart

import 'package:json_dart_generator/json_dart_generator.dart';

void main(List<String> args) {
  var jsonText = '''
[
  [
    {
      "aa": "cc",
      "bb": true,
      "cc": {
        "ilis": [
          10,
          20,
          30.0
        ]
      }
    }
  ]
]
  ''';

  var generator = DartCodeGenerator(
    rootClassName: 'Root', // root class name
    rootClassNameWithPrefixSuffix: true, // root class name include classPrefix / classSuffix
    classPrefix: 'Hi', // class name prefix
    classSuffix: 'Go', // class name suffix
  );

  // call generate to generate code
  var code = generator.generate(jsonText);
  print(code);
}
2
likes
140
pub points
57%
popularity

Publisher

unverified uploader

Convert json data to dart class, Support multiple formats(root is array / multiple array etc).

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

args, collection, dart_style

More

Packages that depend on json_dart_generator