jsonify 0.1.0

jsonify #

A library that helps a developer to turn a object into a json representation

Usage #

First of all you can create an object like this:

class Book extends Object with Jsonify {

  @JsonProperty("author-name")
  String author;
  
  String title;
  
  @JsonIgnore()
  String isbn;
  
  Book(this.author, this.title, this.isbn);
}

Then you can create an object and encode it into json:

Book book = new Book("JK Rowling", "Harry Potter", "1232213343221");
var jsonBook = jsonEncode(book);

Contributing #

If you found a bug, just create a new issue or even better fork and issue a pull request with you fix.

Changelog #

0.1.0 #

  • Make this package dart 2 compatible

0.0.1 #

  • Initial version, created by Stagehand.

example/jsonify.dart

// Copyright (c) 2014, <your name>. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

library jsonify.example;

import 'package:jsonify/jsonify.dart';
import 'dart:convert';

class Book extends Object with Jsonify {
  
  @JsonProperty("author-name")
  String author;
  
  String title;
  
  @JsonIgnore()
  String isbn;
  
  Book(this.author, this.title, this.isbn);
}

main() {
  Book book = new Book("JK Rowling", "Harry Potter", "1232213343221");
  var jsonBook = jsonEncode(book);
  print('book: ${jsonBook}');
}

Use this package as a library

1. Depend on it

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


dependencies:
  jsonify: ^0.1.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

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

3. Import it

Now in your Dart code, you can use:


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

We analyzed this package on Jul 17, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: web, other

Primary library: package:jsonify/jsonify.dart with components: mirrors.

Health suggestions

Format lib/jsonify.dart.

Run dartfmt to format lib/jsonify.dart.

Format lib/src/jsonify_base.dart.

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

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
Dev dependencies
test any

Admin