json-property-filter
JavaScript library and application to filter a JSON object by including and excluding properties.
json-property-filter is a JavaScript library, developed in TypeScript, providing a function to include and/or exclude JSON properties. In addition to providing a function, an executable is available to filter a JSON file.
The library can also be from a Web page: the generated code is ES5 compatible.
Getting Started
Usage
To install to using npm package manager:
npm install json-property-filter
After installation, You can use the library this way:
; ;;;
If you want to have to have a quick overview of all features of this library, take a look at the unit tests or on RunKit website.
Command-Line
You have possibility to run in command-line this library without create a small TypeScript file. This executable provides all the options that are available at the code level. To see all the options, run the following line:
json-property-filter --help
To filter a JSON file and produce a filtered JSON file containing only message
and timestamp
properties, the following options are used:
json-property-filter --in "source.json" --out "destination.json" --filters "message" --filters "timestamp"
To filter a JSON file and display the result formatted with 4 spaces in the console, the following options are used:
json-property-filter --in "source.json" --filters "message" --filters "timestamp" --pretty --pretty-space 4
License
This project is licensed under the MIT License - see the LICENSE file for details.