Skip to content

Instantly share code, notes, and snippets.

@plioi
Created April 26, 2012 03:14
Show Gist options
  • Save plioi/2495421 to your computer and use it in GitHub Desktop.
Save plioi/2495421 to your computer and use it in GitHub Desktop.
Json.Rule =
Choice(True, False, Null, Number, Quotation, Dictionary, Array);
Dictionary.Rule =
from pairs in Between(Token("{"), ZeroOrMore(Pair, Token(",")), Token("}"))
select ToDictionary(pairs);
Pair.Rule =
from key in Quotation
from colon in Token(":")
from value in Json
select new KeyValuePair<string, object>(key, value);
Array.Rule =
from items in Between(Token("["), ZeroOrMore(Json, Token(",")), Token("]"))
select items.ToArray();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment