Skip to content

Fetz/json-analyzer

Repository files navigation

JSON-Analyzer

Build Status GitHub license semantic-release code style: prettier codecov FOSSA Status Known Vulnerabilities

Analyze and measure where you should spend your time optimizing your JSON files or REST APIs. Use it either in our online demo, command line or in your node/browser project.

Examples of things you may need to use this are:

  • Optimizing some REST API payload
  • Initial server render redux state
  • JSON files
  • NO-SQL documents
  • JSON like js objects

Where can you use it:

  • Works in the browser
  • Works in the command line
  • Works in nodejs environment

Using in the command line

Installation - CLI

with yarn:

yarn global add json-analyzer

with npm:

npm install --global json-analyzer

Usage - CLI

with pipe:

cat path/to/file.json | json-analyzer.js

without pipe:

json-analyzer.js path/to/file.json

Option Description
--verbose Show more details of the JSON (like the biggest size node)
--depth Recursive details of each JSON node (ignored if no verbose option)
--target Where to start the analyze (use lodash.get syntax)
--version Display the version of json-analyzer

for more details

Using in the Node/Browser Environment

Installation - Node/Browser

with yarn:

yarn add json-analyzer

with npm:

npm install json-analyzer --save

Usage - Node/Browser

with require:

const jsonAnalyzer = require("json-analyzer");

const jsonObj = { "hello": "world" };

console.log(
  jsonAnalyzer({ json: jsonObj })
);

with import:

import jsonAnalyzer from "json-analyzer";

const jsonObj = { "hello": "world" };

console.log(
  jsonAnalyzer({ json: jsonObj })
);
Option Description
json JSON like object already parsed
verbose Recursive details of each JSON node (ignored if no verbose option)
maxDepth Recursive details of each JSON node (ignored if no verbose option)
target Where to start the analyze (use lodash.get syntax)

for more details

License

This project is licensed under the MIT license, Copyright (c) 2018 Luis Silva. For more information see LICENSE

FOSSA Status