Skip to content

Instantly share code, notes, and snippets.

@porglezomp
Created October 27, 2016 06:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save porglezomp/4b42d1841511bb983f32dba0cc032175 to your computer and use it in GitHub Desktop.
Save porglezomp/4b42d1841511bb983f32dba0cc032175 to your computer and use it in GitHub Desktop.
It's possible to have an extremely simple standard-conformant JSON parser!
# RFC 7159 § 9
# "An implementation may set limits on the size of texts that it accepts."
def parse_json(text):
if len(text) != 1:
raise ValueError("Only accepts single character JSON values")
return int(text[0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment