Navigate JSON in a Linked Data Platform fashion
$ npm install json-to-ldp
This module exposes two apis:
var toLdp = require('json-to-ldp')
var json = {
people: [{
name: "Nicola"
}, {
name: "Virginia"
}]
}
toLDP(json)
/*
{
contains: ["0", "1"]
}
*/
toLDP(json[0])
/*
{
name: "Nicola"
}
*/
var traverse = require('json-to-ldp').traverse
var json = {
title: "Address book"
people: [{
name: "Nicola"
}, {
name: "Virginia"
}]
}
traverse(json, '/people/')
/*
{
title: "Address book"
contains: ["0", "1"]
}
*/
traverse(json, '/people/0')
/*
{
name: "Nicola"
}
*/
MIT