1.0.6 • Published 5 years ago

jsonpathdecoder v1.0.6

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

JSONPathDecoder

JSONPathDecoder is a library designed to help you easily parse lengthy json config files, or just any json at all

Installation

npm i jsonpathdeocder

Normal Usage

const jpd = require('jsonpathdecoder');
let testObject = {
    "accounts" : [
        {
            "name" : "Jared",
            "email" : "jared@npm.org"
        },

        {
            "name" : "Archie",
            "email" : "archie@littlehouseontheprarie.com"
        }
    ]
}

let returnValue = jpd.decode(testObject,'accounts.name');

// OUTPUT: ["Jared", "Archie"]

Array Usage

const jpd = require('jsonpathdecoder');
let testObject = {
    "accounts" : [
        {
            "name" : "Jared",
            "email" : "jared@npm.org"
        },

        {
            "name" : "Archie",
            "email" : "archie@littlehouseontheprarie.com"
        }
    ]
}

let returnValue = jpd.decode(testObject,'accounts.0');

// OUTPUT: {
                "name" : "Jared",
                "email" : "jared@npm.org"
            }

Regex Usage

const jpd = require('jsonpathdecoder');
let testObject = {
    "accounts" : [
        {
            "name" : "Jared",
            "email" : "jared@npm.org"
        },

        {
            "name" : "Archie",
            "email" : "archie@littlehouseontheprarie.com"
        }
    ]
}

let returnValue = jpd.decode(testObject,'accounts./n.*/');

// OUTPUT: ["Jared", "Archie"]
1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago