Skip to content

NouemanKHAL/go-json-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Go solution for the Build Your Own JSON Parser Coding Challenge by John Crickett

Topics

Resources

Stars

Watchers

Forks