A small command line utility to understand the fields, and datatypes in a JSON document.
- JDK >= 17
- Maven
This project creates an executable fat JAR file using the spring-boot-maven-plugin. The JAR will contain the dependencies necessary for execution.
mvn clean install
Usage: json-analyze -i=<file>
-i, --input-file=<file> The JSON file to analyze
cat <<EOF >example.json
{
"version": 1,
"product": {
"name": "Example",
"sizes": [
{"size" : 1 }
],
"weight": 1.5,
"enabled": true
}
}
EOF
java -jar json-schema-explorer-<version>.jar -i example.json
would produce the following output
{
"product.enabled" : "boolean",
"product.name" : "string",
"product.weight" : "float",
"sizes" : [ {
"size" : "integer"
} ],
"version" : "integer"
}
cat <<EOF >example.json
[{
"version": 1,
"product": {
"name": "Example",
"sizes": [
{"size" : 1 }
],
"weight": 1.5,
"enabled": true
}
}]
EOF
java -jar json-schema-explorer-<version>.jar -i example.json
would produce the following output
[ {
"product.enabled" : "boolean",
"product.name" : "string",
"product.weight" : "float",
"sizes" : [ {
"size" : "integer"
} ],
"version" : "integer"
} ]
cat <<EOF >example.json
[
[1],
[0.5],
[true, false],
["string"],
[]
]
EOF
would produce the following output
[ [ "integer" ], [ "float" ], [ "boolean" ], [ "string" ], [ ] ]