pretty_json 2.0.0 copy "pretty_json: ^2.0.0" to clipboard
pretty_json: ^2.0.0 copied to clipboard

A small wrapper for pretty printing JSON objects in a more human readable format. Typically this package would be used for network logging and debugging objects.

pretty_json #

A small wrapper to print JSON objects (Map<String,dynamic>) out neatly.

This is a small Dart wrapper for printing JSON (represented as Map<String,dynamic> or a List in Dart) in a more readable format. Please consider following the author of this project to show some ❤️, Ferdinand Steenkamp and starring the project ⭐ if you use it.

Install #

Install with pub.dev, add this to your pubspec.yaml:

dependencies:
    pretty_json:

Then run pub get or flutter pub get

Usage #

Import the package:

import 'package:pretty_json/pretty_json.dart';

Printing an object out:

void main() {
    
    var json = Map<String,dynamic>{
      'a': 'value a',
      'b': 'value b',
      'c': {  
          'd': 'value d',
          'e': [
            1,
            2,
            3
          ]
      },
    }

    //prettyJson returns a string
    print(prettyJson(json, indent: 2));
    
    //printPrettyJson does the print for us
    printPrettyJson(json, indent: 2);
}

Params:

@required Map<String,dynamic>
@optional indent: int

About #

Pull requests and issues always welcome.

Author #

Ferdinand Steenkamp

License #

Copyright © 2020, Ferdinand Steenkamp. Released under the BSD License.

53
likes
160
pub points
92%
popularity

Publisher

verified publisherferdzz.com

A small wrapper for pretty printing JSON objects in a more human readable format. Typically this package would be used for network logging and debugging objects.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

More

Packages that depend on pretty_json