{"id":16602933,"url":"https://github.com/leonardpepa/jsonparser","last_synced_at":"2026-04-16T17:01:53.274Z","repository":{"id":214004923,"uuid":"726664477","full_name":"Leonardpepa/JSONParser","owner":"Leonardpepa","description":"Minimal JSON Parser written in go for educational purposes","archived":false,"fork":false,"pushed_at":"2024-01-10T01:29:56.000Z","size":2179,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-17T08:45:44.925Z","etag":null,"topics":["coding-challenges","go","golang","json","json-parser","lexer-parser"],"latest_commit_sha":null,"homepage":"https://github.com/Leonardpepa/JSONParser","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Leonardpepa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-03T02:15:27.000Z","updated_at":"2024-01-02T02:53:48.000Z","dependencies_parsed_at":"2023-12-25T04:25:16.296Z","dependency_job_id":"d93a273e-a69a-445c-aaca-1f92566bc6dc","html_url":"https://github.com/Leonardpepa/JSONParser","commit_stats":null,"previous_names":["leonardpepa/jsonparser"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Leonardpepa%2FJSONParser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Leonardpepa%2FJSONParser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Leonardpepa%2FJSONParser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Leonardpepa%2FJSONParser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Leonardpepa","download_url":"https://codeload.github.com/Leonardpepa/JSONParser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242692349,"owners_count":20170228,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coding-challenges","go","golang","json","json-parser","lexer-parser"],"created_at":"2024-10-12T00:45:52.726Z","updated_at":"2026-04-16T17:01:48.176Z","avatar_url":"https://github.com/Leonardpepa.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Minimal JSON Parser written in go\n\n## Purpose\nThis project is a solution for [Write Your Own JSON Parser](https://codingchallenges.fyi/challenges/challenge-json-parser)\nbuild for my personal educational purposes\n\n# Features\n* Parse json into interface{}\n* TODO: implement json stringify\n\n# Implementation Details\nThe implementation is based on the json specification [Introducing JSON](https://www.json.org/json-en.html).\n\n## Lexical analysis\nThis step is responsible to create the tokens.\nA json scanner was implemented from scratch to accomplish this task.\n\n## Syntax analysis\nThis step is responsible to validate the correct structure that matches the formal grammar and create the syntax tree.\nThe parser implemented in this project is a recursive descent parser based on the json context free grammar seen in the specification [Introducing JSON](https://www.json.org/json-en.html).\n\n## Syntax tree \nThe json is parsed directly as an interface{}. Can be used exactly like go manipulates [Generic JSON](https://go.dev/blog/json#generic-json-with-interface)\n\n# Example Usage\n```go\npackage main\n\nimport (\n\t\"JSONParser/JSONParser\"\n\t\"JSONParser/Util\"\n\t\"log\"\n\t\"os\"\n)\n\nfunc main() {\n\tinput, err := os.ReadFile(\"tests/step4/valid2.json\")\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tparsed, err := JSONParser.Parse(input)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tUtil.Printify(parsed)\n}\n```\n## File tests/step4/valid2.json\n```json\n{\n  \"key\": \"value\",\n  \"y\": \"\\u0020\",\n  \"e\": 12.5e-4,\n  \"e2\": 12e+4,\n  \"e3\": 12e-4,\n  \"key-n\": 101000,\n  \"n\" : -12445.1,\n  \"key-o\": {\n    \"inner key\": \"inner value\"\n  },\n  \"key-l\": [\n    \"list value\"\n  ],\n  \"l\" : [1, 2, \"dd\", 3],\n  \"nested\": {\n    \"n\": {\n      \"attr\": true\n    }\n  }\n}\n```\n## Output\n```terminal\n{\n  \"key-n\": 101000,\n  \"n\": -12445.1,\n  \"key-l\": [\"list value\"],\n  \"e\": 0.00125,\n  \"e2\": 120000,\n  \"e3\": 0.0012,\n  \"key-o\": {\n    \"inner key\": \"inner value\"\n  },\n  \"l\": [1, 2, \"dd\", 3],\n  \"nested\": {\n    \"n\": {\n      \"attr\": true\n    }\n  },\n  \"key\": \"value\",\n  \"y\": \" \"\n}\n```\n# How to run\n1. clone the repo ```git clone https://github.com/Leonardpepa/JSONParser```\n2. build ```go build```\n3. run on windows ```JSONParser.exe```\n4. run on linux ```./JSONParser```\n5. test ```go test ./...```\n\n# Tests\nThe parser is tested comparing the results against the native go json package.\nRun the tests ```go test ./...```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonardpepa%2Fjsonparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleonardpepa%2Fjsonparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonardpepa%2Fjsonparser/lists"}