jsonify 0.1.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 65

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';
  
Version Uploaded Documentation Archive
0.1.0 Dec 17, 2018 Go to the documentation of jsonify 0.1.0 Download jsonify 0.1.0 archive
0.0.1 Dec 7, 2014 Go to the documentation of jsonify 0.0.1 Download jsonify 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
29
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]
65
Learn more about scoring.

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

  • Dart: 2.1.0
  • pana: 0.12.10

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