This projects solves the problem of browsing large json files by providing an
emulated shell environment that treats the json file as if it were a filesystem.
This allows the file to be browsed using commands such as ls and cd or
viewed (in human readable yaml) using cat.
This project is build with node and is installable using npm. It should be
installed globally.
$ npm install jsonsmash -g
Any valid json file can be opened by calling jsonsmash path.
$ jsonsmash /path/to/jsonfile.js
Data can also be loaded from a url by calling jsonsmash url.
$ jsonsmash http://example.come/somejson.json
After opening jsonsmash a prompt will appear to accept commands.
The jsonsmash shell treats the json data structure as a file system, with the
root of the data structure represented as / and the keys as either directories
(for objects and arrays) or files.
Paths can be either absolute or relative. Absolute paths must begin with /.
Commands that require a path will default to using the current working directory.
cat [--json] [path]
Print the data structure, defaulting to yaml for human readablility.
If the --json flag is passed the output will be in unformatted json.
cat [path]
Change to the specified path.
echo [string ...]
Print the argument passed to it.
exit
Close the jsonsmash shell.
ls [-lhSr] [path]
Display the children of the specified paths.
-llist in long format.-huse unit suffixes (K,M,G,T) to reduce number of digits to three or less.-Ssort by size instead of alphabetically.-rreverse sort order.
pwd
Print the current working directory.
$ jsonsmash http://headers.jsontest.com/
> cat
X-Cloud-Trace-Context: dbaae9ed37134e4c86d1e02147fe2676/1875084932880129464
Host: headers.jsontest.com
> ls -lh
29 string Host
78 string X-Cloud-Trace-Context
