https://github.com/zokis/sjson
An implementation of a Python JSON parser for educational purposes, implemented in Pure python and Cython
https://github.com/zokis/sjson
Last synced: 9 months ago
JSON representation
An implementation of a Python JSON parser for educational purposes, implemented in Pure python and Cython
- Host: GitHub
- URL: https://github.com/zokis/sjson
- Owner: zokis
- License: mit
- Created: 2015-07-23T23:12:33.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-07-23T23:54:09.000Z (almost 11 years ago)
- Last Synced: 2025-06-13T04:03:27.862Z (about 1 year ago)
- Language: Python
- Size: 203 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sjson
An implementation of a Python JSON parser for educational purposes, implemented in Pure python and Cython
```python
>>> import sjson
>>> a = {
... 'a': 1L,
... 'b': {
... 'a': [
... 1L,
... 2,
... 3,
... 4,
... 5L,
... 'a'
... ],
... 'b': {
... 'a': [],
... '1': 'a'
... }
... },
... 'c': [1e33, -.01e44]
... }
>>> sjson.loads(sjson.dumps(a)) == a
True
```
Errors:
-------
```text
'[#' -> Expected object, array or value
'[1, , ' -> Expected object, array or value
'[1, , ,]' -> Expected object, array or value
'[12,]' -> Expected object, array or value
'[123' -> Failed to decode an array
'[123, ]' -> Expected object, array or value
'[@]' -> Expected object, array or value
'["a","b"' -> Failed to decode an array
'["marcelo]' -> JSON data truncated
'[nulo]' -> Unexpected character found when decoding 'null'
'[trur]' -> Unexpected character found when decoding 'true'
'[false' -> Failed to decode an array
'[falze]' -> Unexpected character found when decoding 'false'
'zokis' -> Expected object, array or value
'{"123"' -> Expecting ':' delimiter
'{"123":' -> Expected object, array or value
'{"123"}' -> Expecting ':' delimiter
'{"a:"b"}' -> Expecting ':' delimiter
'{' -> JSON data truncated
'{,}' -> JSON data truncated
'{123: 456}' -> JSON data truncated
```