@sir_koty/json-extractor
v1.0.1
Published
this library make easy the way to extract property into a json object
Downloads
4
Readme
JSON-EXTRACTOR
This library make easy the way to extract property into a json object
Installation
Usage the npm package manager npm to install json-extractor
npm install @sir_koty/json-extractor
Usage
import { jsonExtract } from '@sir_koty/json-extractor';
const myData = { person: {
firstname: 'J@mes',
lastname: 'Bond'
},
country: {
name: 'Ivory Coast',
code: 225
}
};
const propertiesToExtract = ['person/firstname+lastname@fullname', 'country/name'];
const newJson = jsonExtract(myData, propertiesToExtract);
// newJson value {fullname: 'J@mes Bond', country__name: 'Ivory Coast' }
console.log('newJson value ', newJson);