Giter VIP home page Giter VIP logo

json_printer's Introduction

json_printer

A Flutter package to print JSON objects sequentially, designed with SOLID principles in mind. This package is useful for developers who need a structured and readable way to output JSON data in their Flutter applications.

Motivation

Working with APIs in Dart often involves parsing JSON responses and inspecting data structures. Manually logging JSON data in the console can be cumbersome, requiring developers to sift through lengthy outputs. JSON Printer simplifies this process by neatly formatting JSON objects, enhancing readability and efficiency.

Features

  • Print JSON objects with nested structures in a readable format.
  • Handles nested objects and arrays gracefully.
  • Follows SOLID principles for maintainability and extensibility.
  • Borders and color to enhance readability and distinctiveness when logged.

Getting Started

To start using the json_printer package, add it to your pubspec.yaml:

dependencies:
  json_printer: ^x.x.x # Replace x.x.x with the latest version

Then run flutter pub get to install the package.

Usage

Here is a simple example of how to use the json_printer package:

import 'package:json_printer/json_printer.dart';

void main() {
  Map<String, dynamic> patientDetailsResponse = {
    "hospitalNumber": "123456",
    "name": "John Doe",
    "age": 30,
    "address": {
      "street": "123 Main St",
      "city": "Anytown",
      "state": "Anystate",
    },
    "phoneNumbers": ["234-1234", "234-5678"],
  };

  IJsonFormatter formatter = JsonFormatter();  // Create an instance of JsonFormatter
  IJsonPrinter printer = JsonPrinter(formatter);  // Create an instance of JsonPrinter with the formatter

  printer.printJson(patientDetailsResponse);  // Print the JSON
}

Additional Information

For more information about this package, including how to contribute, file issues, or get in touch with the author, please visit the GitHub repository.

Contributing

Contributions are welcome! If you find a bug or have a feature request, please file an issue. If you'd like to contribute code, please fork the repository and submit a pull request.

Issues

Please file any issues, bugs, or feature requests in the GitHub issues.

json_printer's People

Contributors

yinkyade avatar

Watchers

 avatar

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.