A most easily usable JSON wrapper library in Dart. With JsonPro, you can easily and safely handle JSON on your application.

Overview

A most easily usable JSON wrapper library in Dart!

pub package codecov Analyzer Test

1. About

JsonPro is an open-sourced Dart library.
With JsonPro, you can easily and safely handle JSON on your application.

This library was created with the goal of making JSON easier, more intuitive, and safer to use in the Dart language. For example, as a result of the communication process with the Web API, JSON is returned from the http package and you have ever written the following process when the JSON is set to Response, right?

final json = jsonDecode(value);
final something = json['key'] ?? '';

With JsonPro, the above implementation is no longer necessary!

1.1. Introduction

1.1.1. Install Library

With Dart:

 dart pub add json_pro

With Flutter:

 flutter pub add json_pro

1.1.2. Import It

import 'package:json_pro/json_pro.dart';

1.1.3. Use JsonPro

import 'dart:typed_data';
import 'package:json_pro/json_pro.dart';

void main() {
  // It provides constructors to get JSON from JSON string, JSON map, and JSON bytes.
  final jsonFromString = Json.fromString(value: '{"test": "something"}');
  final jsonFromMap = Json.fromMap(value: {'test': 'something'});
  final jsonFromBytes = Json.fromBytes(
      bytes: Uint8List.fromList('{"test": "something"}'.codeUnits));

  // You can use handful methods in the same interface once instance is created.
  print(jsonFromString.getString(key: 'test'));
  print(jsonFromMap.getString(key: 'test'));
  print(jsonFromBytes.getString(key: 'test'));

  final testJson = Json.fromMap(
    value: {
      'testValueList': ['value1', 'value2'],
      'testJsonString': '{"key1": "value2"}',
      'testJsonList': [
        {
          'key1': 'value1',
          'key2': 'value2',
        }
      ],
      'testRecursiveJsonList': [
        [
          {
            'key1': 'value1',
            'key2': 'value2',
          }
        ],
        {
          'key3': 'value3',
          'key4': 'value4',
        }
      ]
    },
  );

  if (testJson.isEmpty) {
    // Do something when json is empty.
    return;
  }

  // It provides features to safely get values from JSON.
  print(testJson.getStringValues(key: 'testValueList'));

  // You can easily get a JSON object or JSON list associated with a key.
  // If the JSON object associated with the key is a string,
  // it will be automatically detected and parsed into a JSON object.
  print(testJson.getJson(key: 'testJsonString'));
  print(testJson.getJsonList(key: 'testJsonList'));

  // If your JSON list is nested, that's okay!
  // All JSON expressions associated with a key will be returned as JSON objects.
  print(testJson.getJsonList(key: 'testRecursiveJsonList'));
}

1.2. License

Copyright (c) 2021, Kato Shinya. All rights reserved.
Use of this source code is governed by a
BSD-style license that can be found in the LICENSE file.

1.3. More Information

JsonPro was designed and implemented by Kato Shinya.

You might also like...

Easy to use session wrapper that adds support to session storage and management in flutter.

flutter_session_manager Adds an easy to use wrapper to session management in flutter. Allows for easy session storage and management. The session pers

Feb 15, 2022

A flutter utility to easily create flavors in your flutter application

Flutter Flavorizr A flutter utility to easily create flavors in your flutter application Getting Started Let's start by setting up our environment in

Jan 1, 2023

A simple flexible API wrapper for coinbase commerce API. Totally unofficial.

coinbase_commerce A dart library that connects to interact with the Coinbase Commerce API. Enables projects to connect seamlessly to coinbase and rece

Oct 17, 2021

Args simple - A simple argument parser and handler, integrated with JSON and dart

args_simple A simple argument parser and handler, integrated with JSON and dart:

Jan 22, 2022

A Flutter library to make Rest API clients more easily. Inspired by Java Feing.

A Flutter library to make Rest API clients more easily. Inspired by Java Feing. Features Facilitated JSON encode and decode using common interfaces. F

Mar 15, 2022

The diozz package helps you to deal with APIs easily and speed up the process of writing code.

The diozz package helps you to deal with APIs easily and speed up the process of writing code.

Diozz The diozz package helps you to deal with APIs easily and speed up the process of writing code. Installation Diozz Use that command in the termin

Nov 13, 2022

An auto mapper for Dart. It allows mapping objects of different classes automatically and manually using JSON serialization.

AutoMapper for Dart An auto mapper for Dart. It allows mapping objects of different classes automatically and manually using JSON serialization. Examp

Aug 24, 2022

Library that can calculate fusions in Persona 5 game

p5_fusion_dart Library that can calculate fusions in Persona 5 game. Example SkillRepository skillRepository = new SkillRepository(); final PersonaRep

Oct 6, 2022

A flutter application , that create dynamic forms from json data

checktyper A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if th

Aug 23, 2022
Releases(2.3.2)
  • 2.3.2(Jan 4, 2022)

    Please refer to the following release note for the updated contents

    • https://github.com/myConsciousness/json-response/blob/main/CHANGELOG.md
    Source code(tar.gz)
    Source code(zip)
  • 2.3.1(Jan 2, 2022)

    Please refer to the following release note for the updated contents

    • https://github.com/myConsciousness/json-response/blob/main/CHANGELOG.md
    Source code(tar.gz)
    Source code(zip)
  • 2.3.0(Jan 1, 2022)

    Please refer to the following release note for the updated contents

    • https://github.com/myConsciousness/json-response/blob/main/CHANGELOG.md
    Source code(tar.gz)
    Source code(zip)
  • 2.2.0(Jan 1, 2022)

    Please refer to the following release note for the updated contents

    • https://github.com/myConsciousness/json-response/blob/main/CHANGELOG.md
    Source code(tar.gz)
    Source code(zip)
  • 2.1.0(Jan 1, 2022)

    Please refer to the following release note for the updated contents

    • https://github.com/myConsciousness/json-response/blob/main/CHANGELOG.md
    Source code(tar.gz)
    Source code(zip)
  • 2.0.0(Dec 29, 2021)

    Please refer to the following release note for the updated contents

    • https://github.com/myConsciousness/json-response/blob/main/CHANGELOG.md
    Source code(tar.gz)
    Source code(zip)
  • 1.0.2(Dec 27, 2021)

    Please refer to the following release note for the updated contents

    • https://github.com/myConsciousness/json-response/blob/main/CHANGELOG.md
    Source code(tar.gz)
    Source code(zip)
  • 1.0.1(Dec 27, 2021)

    Please refer to the following release note for the updated contents

    • https://github.com/myConsciousness/json-response/blob/main/CHANGELOG.md
    Source code(tar.gz)
    Source code(zip)
  • 1.0.0(Dec 18, 2021)

Owner
Kato Shinya
Freelance software developer. Web and Batch development in Java. Also mobile development in Flutter.
Kato Shinya
A better/safer way to handle environment variables in Flutter.

Envify A better and probably safer way to handle environment variables in Flutter. To read why this is better/safer in details, skip to the motivation

Frenco 96 Nov 5, 2022
library to help you create database on local memory, support json local database inspired by lowdb

Licensed Licensed under the MIT License <http://opensource.org/licenses/MIT>. SPDX-License-Identifier: MIT Copyright (c) 2021 Azkadev <http://github.c

Azka Full Snack Developer:) 35 Oct 17, 2022
Flutter library to add gestures and animations to each Shape you draw on your canvas in your CustomPainter

Flutter library to bring your CustomPainter ?? to Life ✨ ⚡️ touchable library gives you the ability to add various gestures and animations to each Sha

Natesh Bhat 190 Jan 7, 2023
Dart wrapper via dart:ffi for https://github.com/libusb/libusb

libusb Dart wrapper via dart:ffi for https://github.com/libusb/libusb Environment Windows(10) macOS Linux(Ubuntu 18.04 LTS) Usage Checkout example Fea

Woodemi Co., Ltd 28 Dec 20, 2022
Provides null-safety implementation to simplify JSON data handling by adding extension method to JSON object

Lazy JSON Provides null-safety implementation to simplify JSON data handling by adding extension method to JSON object and JSON array. Getting started

Kinnara Digital Studio 0 Oct 27, 2021
A flutter package that allows you to transform your excel to json

excel_to_json A package that allows you to transform your excel to the following format: Excel To JSON Getting Started At current the package allows y

Vitor Amaral de Melo 0 Nov 7, 2022
Minimal Dart wrapper to interact with Some Random Api. Easy to use, simplified and lightweight.

SRA - Some Random Api Minimal Dart wrapper to interact with Some Random Api. Easy to use, simplified and lightweight. Getting started Add the package

Yakiyo 3 Jan 4, 2023
A package that lets you include a cool, nice looking and validated Password TextFormField in your app to enhance user experience. The package is fully & easily modifiable.

A package that lets you include a cool, nice looking and validated Password TextFormField in your app to enhance user experience. The package is fully

Muhammad Hamza 20 Jun 7, 2022
Official Git of flutter code-push made by Chimera inc. If you want to get more info or seek for biz corporation, you can contact [email protected].

中文版 Chimera Flutter Code Push Chimera is a Dart compiler developed by ourselves, which generates interpretable and executable bytecode to implement co

Waytoon 21 Oct 6, 2022
Library for help you make userbot or bot telegram and support tdlib telegram database and only support nodejs dart and google-apps-script

To-Do telegram client dart ✅️ support multi token ( bot / userbot ) ✅️ support bot and userbot ✅️ support telegram-bot-api local server ✅️ support tel

Azka Full Snack Developer:) 73 Jan 7, 2023