Ruby JSON Problem


I’am new to Ruby and JSON, and having some trouble with it. I try to get
JSON Objects from the Toodledo API 2.0. They say they are working with
JSON objects, but I guess they are using Arrays as well, now I dont know
how to get the elemnts or objects inside the Array, I can use
“pretty_generate”, but not json[ “id” ] to just get the id of the task.
My goal is, to get the elements and beeing able to format them, to use
them in haml and make it look good.

first attempt:

 get '/save' do

response = RestClient.get***;modafter=1234567890;fields=folder,star,priority’,
{:accept => :json}
test = JSON.parse(response)
blub = JSON.pretty_generate(test)
test1 = blub[1…-2]
puts test1

Someone told me “RestClient.get” isn’t very practial, so I tried :

get ‘/test’ do
res =
p res.body

but can only output one Character.

This is the JSON Data i get from toodledo:
[{“num”:“4”,“total”:“4”},{“id”:“11980343”,“title”:“Add some items to
your todo
the Settings section and configure your
our tutorial videos in the Help

I’am desperate for help now :smiley:

Thank you in advance


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs