https://github.com/drkwitht/toy_json_parser
My very first working toy json parser!
https://github.com/drkwitht/toy_json_parser
c json-parser parsing speedcoding toy-project
Last synced: about 1 year ago
JSON representation
My very first working toy json parser!
- Host: GitHub
- URL: https://github.com/drkwitht/toy_json_parser
- Owner: DrkWithT
- Created: 2023-03-25T00:10:25.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-25T23:03:20.000Z (almost 3 years ago)
- Last Synced: 2025-02-09T23:32:57.843Z (over 1 year ago)
- Topics: c, json-parser, parsing, speedcoding, toy-project
- Language: C
- Homepage:
- Size: 96.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Toy JSON Parser
## By: Derek Tan
### Summary:
This repository contains code for a homemade recursive JSON parser in C. Because this is a toy parser, not all standard JSON features are meant to be supported. I do not intend this to be a production-ready, blazingly fast parser, but I made this for fun. Feel free to fork my work in progress project.
### Usage:
- Build: `make all`
- Run: `./myjson `
- Test 1: Access Array in an Object.
- Test 2: Access the first item in a plain Array.
- Test 3: Access a property of the second Object in a list of Objects.
- Clean: `make clean`
### Caveats:
1. No backslash escaped characters.
2. No Unicode support.
3. No booleans yet. (I should add this!)
4. The JSON source is copied into a memory buffer which is inefficient use of memory for larger files _if_ I intend to later support those file sizes.
5. The parser code has some ugly spaghetti in the parse object function.
### To Do:
1. ~~Implement JSON data structures!~~
2. ~~Implement Lexer.~~
3. ~~Implement recursive token parser.~~
4. ~~Test run parse result and do structure function tests.~~
5. ~~Refactor helper function for reading JSON file.~~
6. Refactor `Parser_Parse_Obj(...)`, specifically the "expect" flags.
7. Add another test for `null` property values.