Cosinhs / pj

A small, hand-written Python JSON library

Home Page:http://notes.eatonphil.com/writing-a-simple-json-parser.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pj

This is a small, hand-written library for encoding and decoding JSON strings and objects in Python. I wrote it because I wanted a small example to demonstrate the simplest hand-written parser techniques and couldn't find any obvious results on Google.

Here is the original blog post explaining the concepts and implementation of this library.

Use

import pj

print(pj.to_string(pj.from_string('{"foo":{"bar":[1,2,3]}}')))

Tests

python3 -m unittest

Quality

The number detection is bad. There are tons of missing cases not handled. There is no line/column tracking. The primary purpose of this library is for education.

About

A small, hand-written Python JSON library

http://notes.eatonphil.com/writing-a-simple-json-parser.html


Languages

Language:Python 100.0%