This is my solution to the second problem in the John Crickett's Coding Challenges.
I made this project just for fun and to play around with lexers and parsers, it is still a work in progress.
-
Clone the repo
-
Run the tool using of the following approaches:
# Run the tool automatically using the go command $ go run . [file] [path] # Build a binary and run it manually $ go build -o gojson $ ./gojson [file] [path] # Install the binary in your environment, and run it: $ go install $ gojson [file] [path]
-
Done!
Usage:
gojson [FILE] [PATH]
Example:
gojson tests/step1/valid.json .key
cat file.json | gojson .foo.bar[0]
$ gojson tests/step4/valid2.json .key-o
{"inner key": "inner value"}
$ gojson tests/step4/valid.json .key
"value"
$ gojson tests/step3/invalid.json
cannot parse value, got token 'False' at line 3:9
exit status 1