Skip to content

Latest commit

 

History

History
112 lines (90 loc) · 3.21 KB

README.md

File metadata and controls

112 lines (90 loc) · 3.21 KB

JSON Parser and Search Utility

forthebadge forthebadge forthebadge

Description

This is a Rust-based command-line utility designed to parse, analyze, and search JSON files efficiently. It provides a simple way to explore JSON structures, locate specific values, and handle complex data formats. The program supports flexible input methods (file paths or stdin) and highlights search results for better readability.

Features

  • Parse and pretty-print JSON files.
  • Search for specific values within JSON structures.
  • Display the full path (keys or indices) to the matched values.
  • Show indices when matches occur within arrays.
  • Support for input via file paths or standard input (stdin).
  • Color-coded output for search results.

Prerequisites

  • Rust (latest stable version)

Clone and Build

  1. Clone this repository:
    git clone https://github.com/nightwolf-1/json_parser.git
    cd json-parser
  2. Build the project:
    cargo build --release
  3. The binary will be avialable in the target/release directory:
    ./target/release/json_parser

Usage:

Parse a JSON file

./json_parser data.json

Print all json

You can also use standard input

cat data.json | ./json_parser data.json

Print all json stdin

To print a specific key of json

./json_parser data.json skills

Exemple key

You can also use standard input

cat data.json | ./json_parser skills

Exemple key stdin

To print a specific index of key in json

./json_parser data.json skills 2

Exemple specific index of key

You can also use standard input

cat data.json | ./json_parser skills 2

Exemple specific index of key stdin

To print a nested oject

./json_parser data.json details.city

Exemple nested object

You can also use standard input

cat data.json | ./json_parser details.city

Exemple nested Object stdin

To print a nested object with specific tab index

./json_parser data.json details.city 1

Exemple nested object index

You can also use standard input

cat data.json | ./json_parser details.city 1

Exemple nested Object stdin

To print all occurences of a value

./json_parser -s javascript data.json

Exemple print all occurences of a value

You can also use standard input

cat data.json | ./json_parser -s javascript

Exemple print all occurences of a value stdin