A Java-based command-line tool for parsing, analyzing, and navigating complex JSON structures.
It supports recursion, path-based navigation (e.g., user.name, courses[0].title), color-coded output, and element statistics.
- β Recursively parse and print nested JSON objects and arrays
- β Color-coded output for keys and values (via ANSI escape codes)
- β
Path-based navigation to access specific values (e.g.
user.name,items[2].details.price) - β Type statistics: counts how many strings, numbers, booleans, nulls, arrays, and objects
- β Error handling for invalid paths
Given the input:
{
"user": {
"name": "JoΓ£o",
"skills": ["Java", "Python"]
},
"courses": [
{ "title": "Java POO" },
{ "title": "React" }
]
}You can:
- View the entire structure recursively
- Type
user.nameto get"JoΓ£o" - Type
user.skills[1]to get"Python" - Type
courses[0].titleto get"Java POO"
-
Clone this repo:
git clone https://github.com/joaobenedetmachado/JavaJSON.git cd JavaJSON -
Compile with Maven or your preferred Java build tool (Java 8+):
mvn clean package
-
Run:
java -jar target/JavaJSON.jar
-
Paste your JSON when prompted, then use path navigation.
- Gson for JSON parsing
- ANSI color codes for terminal styling
src/
βββ main/
β βββ java/
β β βββ org/
β β βββ example/
β β βββ Main.java
β β βββ colors/
β β β βββ Colors.java
β β βββ models/
β β βββ JsonStats.java
JoΓ£o Victor Benedet Machado
Feel free to fork, contribute, and improve!