json_utilities 0.1.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 88

json_utilities #

Dart/Flutter package to enhance the experience of working with json based models.

Can be used in conjunction with json_serializable.

See Examples for more details.

General Idea #

The general/basic idea was to have something similar like lodash or ramda when working with 'JSON' / Map<String,dynamic> in Dart.

Some operations like checking for existence of certain JSON leafs can be tedious, that's where this package is supposed to come in and save the day!

This is a growing library, contributions are welcome!

Usage #

To use this plugin, add json_utilites as a dependency in your pubspec.yaml file

Examples #

Basic Example #

import 'package:json_utilities/json_utilities.dart';

var json = <String, dynamic>{
  'root': 'value',
  'root2': <String, dynamic>{'leaf': 'fruit'}

JSONUtils().get(json,'root.leaf', 'defaultValue') // returns String defaultValue
JSONUtils().get(json,'root', 'defaultValue') // returns String value
JSONUtils().get(json,'root2', 'defaultValue') // <String, dynamic>{'leaf': 'fruit'}
JSONUtils().get(json,'root.leaf.deeperLeaf', 'defaultValue') / returns String defaultValue

json_serializable Example #

// model/Condition.dart
import 'package:json_annotation/json_annotation.dart';

part 'Condition.g.dart';

class Condition {

  String text;
  String language;


   * Json to Location object
  factory Condition.fromJson(Map<String, dynamic> json) =>

   * Location object to json
  Map<String, dynamic> toJson() => _$ConditionToJson(this);

import 'package:json_utilities/json_utilities.dart';
import 'model/Condition.dart';

    Condition condition;


       return JSONUtils().get(condition.toJson(),'language', 'none');


  • Added CHANGELOG.md and README.md with basic examples
  • Added MIT License


  • Initial release


import 'package:json_utilities/json_utilities.dart';

var json = <String, dynamic>{
  'root': 'value',
  'root2': <String, dynamic>{'leaf': 'fruit'}

String value = JSONUtils().get(json,'root.leaf', 'defaultValue');

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  json_utilities: ^0.1.3

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:json_utilities/json_utilities.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jan 20, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5

Health suggestions

Format lib/json_utilities.dart.

Run flutter format to format lib/json_utilities.dart.

Maintenance suggestions

Package is getting outdated. (-3.29 points)

The package was last published 53 weeks ago.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies