jsonpathdecoder
v1.0.6
Published
JSONPathDecoder is a library designed to help you easily parse lengthy json config files, or just any json at all
Downloads
4
Readme
JSONPathDecoder
JSONPathDecoder is a library designed to help you easily parse lengthy json config files, or just any json at all
Installation
npm i jsonpathdeocderNormal Usage
const jpd = require('jsonpathdecoder');
let testObject = {
"accounts" : [
{
"name" : "Jared",
"email" : "[email protected]"
},
{
"name" : "Archie",
"email" : "[email protected]"
}
]
}
let returnValue = jpd.decode(testObject,'accounts.name');
// OUTPUT: ["Jared", "Archie"]Array Usage
const jpd = require('jsonpathdecoder');
let testObject = {
"accounts" : [
{
"name" : "Jared",
"email" : "[email protected]"
},
{
"name" : "Archie",
"email" : "[email protected]"
}
]
}
let returnValue = jpd.decode(testObject,'accounts.0');
// OUTPUT: {
"name" : "Jared",
"email" : "[email protected]"
}
Regex Usage
const jpd = require('jsonpathdecoder');
let testObject = {
"accounts" : [
{
"name" : "Jared",
"email" : "[email protected]"
},
{
"name" : "Archie",
"email" : "[email protected]"
}
]
}
let returnValue = jpd.decode(testObject,'accounts./n.*/');
// OUTPUT: ["Jared", "Archie"]