json5 0.5.3 copy "json5: ^0.5.3" to clipboard
json5: ^0.5.3 copied to clipboard

outdated

JSON for dart and flutter (a port version of json5 in javascript)

JSON5 for dart and flutter #

Dart CI

This dart-package is a ported version of json5 which is written in pure javascript.

We use the same algorithms, so we have the same behaviors, the same specification.

But dart have different name convention, see the code below.

Usage #

import 'package:json5/json5.dart';

void main() {
  var obj = JSON5.parse('{                '
      '  /*  comment block  */            '
      '  name: {first: "phat"},           '
      '  lang: ["C++", "dart", "kotlin"], '
      '  nums: [NaN, Infinity, -Infinity] '
      '} // end object                    ');

  var compact = JSON5.stringify(obj);

  print(compact);

  var pretty = JSON5.stringify(obj, space: 2);

  print(pretty);
}

Current limitations #

  • It can parse String only, stream is not support
  • Only serialize classes which implement List and Map

References #

20
likes
0
points
2.99k
downloads

Publisher

verified publisherdamphat.com

Weekly Downloads

JSON for dart and flutter (a port version of json5 in javascript)

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on json5