get-json-value
Command Line Tool that returns the value of a key path (
some.key.path
) in one or multiple JSON files.
Installation
$ npm i -g get-json-value
Usage
By default it looks for JSON files in the current working directory.
$ get-json-value <object.key.path> <file>
Examples
Executed in a directory with the following files and contents:
locales/|__esjson // {"home": {"greeting": "Hola"}}|__enjson // {"home": {"greeting": "Hello"}}
It will output:
$ get-json-value home.greeting es Holaen Hello
Passing file name (without extension):
$ get-json-value home.greeting es es Hola
Custom search directory
You can specify a custom search directory, for instance, for usage in npm-scripts, by setting the Node env variable GJV_SEARCH_DIR
.
"scripts":
$ npm run getvalue some.path