instance method JSON::Parser#source

source -> String[permalink][rdoc][edit]

現在のソースのコピーを返します。



require 'json'

parser = JSON::Parser.new(DATA.read)
print parser.source

# => {
# =>   "Tanaka": {
# =>     "name":"tanaka",
# =>     "age":20
# =>   },
# =>   "Suzuki": {
# =>     "name":"suzuki",
# =>     "age":25
# =>   }
# => }

__END__
{
  "Tanaka": {
    "name":"tanaka",
    "age":20
  },
  "Suzuki": {
    "name":"suzuki",
    "age":25
  }
}