Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nouemankhal/go-json-parser
Go solution for the Build Your Own JSON Parser Coding Challenge by John Crickett
https://github.com/nouemankhal/go-json-parser
go json lexer parser
Last synced: 1 day ago
JSON representation
Go solution for the Build Your Own JSON Parser Coding Challenge by John Crickett
- Host: GitHub
- URL: https://github.com/nouemankhal/go-json-parser
- Owner: NouemanKHAL
- Created: 2024-03-24T00:14:00.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-04-07T21:59:19.000Z (7 months ago)
- Last Synced: 2024-04-07T23:33:54.103Z (7 months ago)
- Topics: go, json, lexer, parser
- Language: Go
- Homepage: https://codingchallenges.fyi/challenges/challenge-json-parser
- Size: 25.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Coding Challenge #2: Build Your Own JSON Parser
This is my solution to the second problem in the [John Crickett's Coding Challenges](https://codingchallenges.fyi/challenges/challenge-json-parser/).
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
1. Run the tool using of the following approaches:```shell
# 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]
```
1. Done!## Usage
```shell
Usage:
gojson [FILE] [PATH]Example:
gojson tests/step1/valid.json .key
cat file.json | gojson .foo.bar[0]
```## Examples
```shell
$ 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
```