fastjson_ref_resolver

0.0.3 • Public • Published

fastjson_ref_resolver

A Javascript library to resolve circular references in JSON exports by FastJson library

Install

npm install fastjson_ref_resolver

Usage

var Resolver = require('fastjson_ref_resolver').Resolver;
var data = [
    {
    carConfig: {
        colorOption: {
            description: "red color",
            name: "Red"
        },
    },
    id: "5719b01ed966d76a183a79e4",
    state: "OPEN"
    },
    {
    carConfig: {
        colorOption: {
            "$ref": "$[0].carConfig.colorOption"
        }
    },
    id: "5719b01ed966d76a183a79e5",
    state: "CLOSE"
    }
];
 
var resolved = new Resolver(data).resolve();
console.log(resolved);

The above code will print out

[
    {
    carConfig: {
        colorOption: {
            description: "red color",
            name: "Red"
        },
    },
    id: "5719b01ed966d76a183a79e4",
    state: "OPEN"
    },
    {
    carConfig: {
        colorOption: {
            description: "red color",
            name: "Red"
        }
    },
    id: "5719b01ed966d76a183a79e5",
    state: "CLOSE"
    }
];

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.3
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.3
    2
  • 0.0.2
    0
  • 0.0.1
    0

Package Sidebar

Install

npm i fastjson_ref_resolver

Weekly Downloads

1

Version

0.0.3

License

MIT

Last publish

Collaborators

  • greenlaw110