Skip to content

Instantly share code, notes, and snippets.

@jwaldrip
Last active December 11, 2015 03:58
Show Gist options
  • Save jwaldrip/4541203 to your computer and use it in GitHub Desktop.
Save jwaldrip/4541203 to your computer and use it in GitHub Desktop.
a simple JSON parser in pure ruby.
module JSON
def self.parse(string)
# replace "key":"val" with "key" => "val", and evaluate
eval string.gsub(/(".[^"]+"):/, "\\1 => ")
end
def self.null
nil
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment