I'm trying to convert some API response data into a Ruby hash or array so I can more easily work with it. Here's the JSON string being returned by the API:
[
{
"id": 2,
"name": "TestThing",
"token": "B2CA27221DB976E48248F26756289B91"
},
{
"id": 3,
"name": "AnotherTestThing",
"token": "EF16E5F20B8463E48DBF3BA8F0E1102A"
}
]
I believe that is a JSON array? I tried doing JSON.parse
on that string, but got (JSON::ParserError)r/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/json/common.rb:148:in 'parse': 746: unexpected token at '1511
What is the best way to convert this into something I can easily work with? My real goal here is to iterate over the tokens returned.