Skip to content

Resolves "_ref" references in JS object to JSON files

License

Notifications You must be signed in to change notification settings

juliankern/jsonrefs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

jsonrefs

Resolves "_ref" references in JS object to JSON files

Usage

npm install --save jsonrefs

test.json:

{
    "one": 1,
    "two": 2, 
    "object": {
        "child": {
            "_ref": "other.json"
        }
    }
}

other.json:

{
    "filename": "other.json",
    "this": "is",
    "a": "test"
}

use jsonrefs:

var jsonref = require('jsonrefs');

jsonref.parse(require('../jsonrefs/test.json'));

result:

{ 
    "one": 1,
    "two": 2,
    "object": { 
        "child": { 
            "filename": "other.json",
            "this": "is",
            "a": "test",
            "_oldref": "other.json" 
        } 
    } 
}

About

Resolves "_ref" references in JS object to JSON files

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published