# JSON parsed by Ruby
require 'json'
badges = File.open("badges.txt", "r")
doc = ""
badges.each do |line|
doc << line
end
badges.close
puts JSON.parse(doc)
JSON data for badges.txt
{
"badges" :
{
"badge1" : {
"name" : "Name of Badge1",
"subject" : "Subject of Badge1 "
},
"badge2" : {
"name" : "Name of Badge2",
"subject" : "Subject of Badge2 "
}
}
}
Written by Jake Cooper
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#