Skip to content

tsheinen/json-schema-minimizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json-schema-minimizer

command line tool to reduce JSON into the minimum required to define the schema. Values are reduced according to the following rules.

usage: cat data.json | ./json-schema-minimizer > minimum.json

Value Type Result
Null Null
Bool False
Number 0
String ""
Array Recursive reduction and duplicates are removed
Object Recursive reduction and duplicates are removed

for example

{
  "favorite_color": null,
  "is_owner": true,
  "age": 25,
  "name": "Bob",
  "generic_list": [
    "hello",
    "howdy",
    55,
    []
  ],
  "generic_object": {
    "k1": "v1",
    "k2": "v2",
    "k3": 3
  }
}

becomes

{
  "age": 0.0,
  "favorite_color": null,
  "generic_list": [
    "",
    0.0,
    []
  ],
  "generic_object": {
    "k1": "",
    "k3": 0.0
  },
  "is_owner": false,
  "name": ""
}

About

command line tool to reduce JSON into the minimum required to define the schema

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages