@sir_koty/json-extractor
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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);

Demo

Sample on Stackblitz

License

MIT

Package Sidebar

Install

npm i @sir_koty/json-extractor

Weekly Downloads

0

Version

1.0.1

License

ISC

Unpacked Size

6.75 kB

Total Files

10

Last publish

Collaborators

  • sir_koty