Skip to content

Latest commit

 

History

History
50 lines (35 loc) · 1.06 KB

README.md

File metadata and controls

50 lines (35 loc) · 1.06 KB

Coding Challenge #2: Build Your Own JSON Parser

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.

Setup

  1. Clone the repo

  2. 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]
  3. Done!

Usage

Usage:
	gojson [FILE] [PATH]

Example:
    gojson tests/step1/valid.json .key
    cat file.json | gojson .foo.bar[0]

Examples

$ 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