nice_json 1.0.0 copy "nice_json: ^1.0.0" to clipboard
nice_json: ^1.0.0 copied to clipboard

A nice way to encode nice maps into nice-looking json.

example/example.dart

import 'package:nice_json/nice_json.dart';

void main(List<String> args) {
  Map<String, dynamic> data = {
    'a': [0, 1],
    'b': [
      [0, 1],
      [2, 3],
    ],
    'person': {'first_name': 'Alexander', 'last_name': 'Baker'},
    'cats': ['gau', 'saturn', 'yipyip', 'morgana'],
    'catscatscatscatscatscatscatscatscatscatscatscats': ['gau', 'saturn', 'yipyip', 'morgana'],
    'kittens': ['boy', 'violet', 'pumpkin'],
    'mixedList': [
      'boy',
      ['violet', 'pumpkin'],
      [1111111, 2222222, 3333333, 4444444, 5555555],
      {'name': 'saturn', 'age': 3, 'species': 'cat'},
    ],
    'location': {'x': 0, 'y': -1.5},
    'location2': {'x': -6.1, 'y': 2},
    'book':
        'a really really really really really long string will obviously not get wrapped at all',
  };

  String json = niceJson(data, alwaysExpandKeys: ['kittens', 'location2']);
  print(json);
}
2
likes
0
pub points
49%
popularity

Publisher

verified publisheralxbkr.xyz

A nice way to encode nice maps into nice-looking json.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on nice_json