https://github.com/andyglow/simple-java-json-parser
Simple Java JSON Parser
https://github.com/andyglow/simple-java-json-parser
java json
Last synced: about 2 months ago
JSON representation
Simple Java JSON Parser
- Host: GitHub
- URL: https://github.com/andyglow/simple-java-json-parser
- Owner: andyglow
- License: lgpl-3.0
- Created: 2017-11-12T03:08:17.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-10-19T21:43:50.000Z (over 3 years ago)
- Last Synced: 2025-03-28T17:13:49.272Z (about 1 year ago)
- Topics: java, json
- Language: Java
- Size: 12.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# simple-java-json-parser
[](https://travis-ci.org/andyglow/simple-java-json-parser)
[](https://coveralls.io/github/andyglow/simple-java-json-parser?branch=master)
Simple Java JSON Parser
Remember SAX for XML parsing?
This project aims to implement the same idea but for JSON parsing.
The second goal is to provide lightweight embeddable JSON parser which would be used by code copying (not depending on this project).
# API
API is simple.
We have Handler which accepts events of type:
- START
- END
- OBJECT_START
- OBJECT_END
- ARRAY_START
- ARRAY_END
- NAME
- VALUE
And we have Parser which takes a stream of bytes (or string) and generates sequence of events.
Which is basically it. All the code is consists in one file/class.
## Example
```
import json.Parser
import static json.Parser.*;
Handler handler = ...
new Parser("{ \"foo\": \"bar\" }", handler).parse();
```