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.name
to get"João"
- Type
user.skills[1]
to get"Python"
- Type
courses[0].title
to 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!