Code Monkey home page Code Monkey logo

pretty_json's Introduction

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.

pretty_json's People

Contributors

fsteenkamp avatar swapnens avatar uslashvlad avatar katutxakurra avatar

Stargazers

ASAD HAMEED avatar Tyson Phalp avatar Andrii Kovalchuk avatar Niko Shens avatar ebwood avatar Ankit Roy avatar Efrain May avatar  avatar Britannio Jarrett avatar Plague Fox avatar  avatar

Watchers

James Cloos avatar  avatar

pretty_json's Issues

Printing lists of maps

Your printPrettyJson takes only dynamic maps.
You should also support jsons where the external object is a list.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.