This project is a custom implementation of a JSON parser. It was created as part of a coding challenge here. The utility is designed to validate and parse JSON files, as well as run predefined tests on JSON datasets to ensure their correctness.
- Validate JSON files for syntax and structural correctness.
- Identify and report detailed errors in JSON files.
- Run predefined tests on JSON files to verify their validity.
- Efficiently parse and validate JSON from files up to 100MB in size.
- Command-line interface (CLI) powered by Cobra for easy usage.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- You need to have Go installed on your machine (Go 1.15 or later is recommended).
- You can download and install Go from https://golang.org/dl/.
Clone the repository to your local machine:
git clone https://github.com/nullsploit01/cc-json-parser.git
cd cc-json-parser
Compile the project using:
go build -o ccjp
go test ./...
To run the utility, you can either validate a JSON file or run predefined tests. The command-line interface (CLI) provides flags for different operations:
./ccjp --json-parser path/to/file.json
./ccjp --run-tests
This command runs predefined tests on JSON files located in the test directories (./test_data/pass and ./test_data/fail). The tests check whether the files pass or fail as expected.
./ccjp --json-parser test_data/pass/valid_3.json