A simple JSON parser written in Python in for educational purposes. I think JSON is a fun language to write a parser for because of its simplicity.
-
Clone/download the project repo to your machine
-
Move the
python_json_parser
directory into your project directory -
Import the module at the top of your file:
import python_json_parser
-
Call the
load_json_string
and pass a JSON string to it to convert the JSON string into a Python object:json_string = ''' { "first name":"Arthur", "last name": "Dent", "age":42, "interests": [ "flying", "sandwich making" ] } ''' result = python_json_parser.load_json_string(json_string)
Distributed under the MIT License. See LICENSE for more information.
Please visit my website for ways of contacting me.
- JSON.org for the JSON schema
- Compilers: Principles, Techniques, and Tools for an introduction to lexical analysis and parsing