json_render 1.0.1

  • Readme
  • Changelog
  • Installing
  • new49

json_render #

JSON Web Render Framework

Usage #

A simple usage example:

import 'dart:html';
import 'package:json_render/json_render.dart';

main() {

    var jsonStr = '{ "user": "Joe Smith", "creationDate": 1581296519401, "picture": "http://host/path/to/image.jpeg", "enabled": true , "homepage": "http://www.geocities.com/awesome-home-page" }';
    JSONRender jsonRender = JSONRender.fromJSONAsString(jsonStr)
      // Show input elements:
      ..renderMode = JSONRenderMode.INPUT
      // Renders Strings with image URL as image elements in lazyload mode (only loads image when viewed, reducing bandwidth usage):
      ..addTypeRender( TypeImageURLRender( lazyload: true ) )
      // Renders numbers in unix epoch time-millis range as dates:   
      ..addTypeRender( TypeTimeMillisRender() )
      // Renders URL string as links.
      ..addTypeRender( TypeURLRender() )

    var divOutput = querySelector("#output");

    jsonRender.renderToDiv(divOutput) ;

    divOutput.onClick.listen( (e) {
      // Generates JSON from rendered elements in input mode and print to console:
      print( jsonRender.buildJSONAsString() ) ;
    } ); 


Features and bugs #

Please file feature requests and bugs at the issue tracker.

Author #

Graciliano M. Passos: gmpassos@GitHub.

License #

Dart free & open-source license.

1.0.1 #

  • Now TypeTimeMillisRender, in JSONRenderMode.VIEW, shows date in format: yyyy/MM/dd HH:mm:ss

1.0.0 #

  • Initial version, created by Stagehand

Use this package as a library

1. Depend on it

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

  json_render: ^1.0.1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or 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_render/json_render.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 Feb 26, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5

Health suggestions

Format lib/src/json_render_base.dart.

Run dartfmt to format lib/src/json_render_base.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and json_render.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
dom_tools ^1.0.0 1.0.0
intl ^0.16.0 0.16.1
mercury_client ^1.0.6 1.0.7
Transitive dependencies
enum_to_string 1.0.9
path 1.6.4
Dev dependencies
pedantic ^1.8.0
test ^1.6.0