json_object_lite 1.1.2

  • README.md
  • Example
  • Installing
  • Versions
  • 75


Build Status

json_object_lite allows dot notation access to JSON.parse'd objects, for Dart, lite version.

This package is a re-implementation of the json_object package by Chris Buckett except it doesn't use mirrors and hence is a much lighter version. You of course lose the JSON serialization/deserialization of the original package, however there are more advanced packages you can use for this purpose, e.g dson.

Other than that this is a faithful, lighter, re-implementation intended as a drop in replacement for the original JsonObject. Please see the json_object documentation for further details.

1.1.2<br><br> Pub updates

1.1.1<br><br> Strong mode updates for pub

1.1.0<br><br> Fix immutability to follow that of json_object, not reverse it

1.0.2<br><br> Fix failing test in Chrome

1.0.1<br><br> Issue 1, library name bug

1.0.0<br><br> Initial Release


/// This example is taken from the following article :-
/// http://www.dartlang.org/articles/json-web-service/

import 'package:json_object_lite/json_object_lite.dart';

/// An example taken from the dartlang article for JSON object, found here
/// https://webdev.dartlang.org/articles/get-data/json-web-service.

class LanguageWebsite extends JsonObjectLite {
  LanguageWebsite(); // default constructor (empty) implementation

  factory LanguageWebsite.fromJsonString(String json) {
    // from JSON constructor implementation
    final languageWebsite =
    new LanguageWebsite(); // create an empty instance of this class
    // Create an instance of JsonObjectLite, populated with the json string and
    // injecting the _LanguageWebsite instance.
    final jsonObject = new JsonObjectLite.fromJsonString(json, languageWebsite);
    return jsonObject; // return the populated JsonObject instance

  factory LanguageWebsite.fromJsonObject(JsonObjectLite jsonObject) {
    return JsonObjectLite.toTypedJsonObjectLite(
        jsonObject, new LanguageWebsite());

class Language extends JsonObjectLite {
  Language(); // empty, default constructor

  factory Language.fromJsonString(String json) {
    // from JSON constructor implementation
    return new JsonObjectLite.fromJsonString(
        json, new Language()); // as _LangaugeWebsite, return an instance
    // of JsonObjectLite, containing the json string and
    // injecting a _Language instance

int main() {
  final responseText = """
  "language": "dart", 
  "targets": ["dartium","javascript"], 
  "website": {
    "homepage": "www.dartlang.org",
    "api": "api.dartlang.org"
  final Language data = new Language.fromJsonString(responseText);

  // tools can now validate the property access
  print(data.language); // should be dart
  print(data.targets[0]); // should be dartium

  // nested types are also strongly typed
  final LanguageWebsite website = new LanguageWebsite.fromJsonObject(
      data.website); // contains a JsonObjectLite
  website.isImmutable = false; // Now we can extend it
  website.homepage = "http://www.dartlang.org";

  return 0;

1. Depend on it

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

  json_object_lite: "^1.1.2"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:

import 'package:json_object_lite/json_object_lite.dart';
Version Uploaded Documentation Archive
1.1.2 Feb 19, 2018 Go to the documentation of json_object_lite 1.1.2 Download json_object_lite 1.1.2 archive
1.1.1 Dec 11, 2017 failed Download json_object_lite 1.1.1 archive
1.1.0 Oct 16, 2017 failed Download json_object_lite 1.1.0 archive
1.0.2 Oct 13, 2017 failed Download json_object_lite 1.0.2 archive
1.0.1 Oct 2, 2017 failed Download json_object_lite 1.0.1 archive
1.0.0 Sep 26, 2017 failed Download json_object_lite 1.0.0 archive


We analyzed this package on Apr 23, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.49.0
  • pana: 0.10.6


Describes how popular the package is relative to other packages. [more]
63 / 100
Code health derived from static analysis. [more]
79 / 100
Reflects how tidy and up-to-date the package is. [more]
99 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:json_object_lite/json_object_lite.dart.


  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 1 error 3 hints.

    Strong-mode analysis of lib/json_object_lite.dart failed with the following error:

    line: 251 col: 3
    Invalid override. The type of 'JsonObjectLite.map' ('<T>((dynamic) → dynamic) → Iterable<T>') isn't a subtype of 'Map<dynamic, dynamic>.map' ('<K2,V2>((dynamic, dynamic) → MapEntry<K2, V2>) → Map<K2, V2>').


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <2.0.0
Dev dependencies
coverage ^0.7.3
dart_dev ^1.0.0
dart_style >=0.2.0 <0.3.0
dartdoc >=0.8.0 <=0.10.0
test ^0.12.0