Last active
December 11, 2015 03:58
-
-
Save jwaldrip/4541203 to your computer and use it in GitHub Desktop.
a simple JSON parser in pure ruby.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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