Rails provides an excellent XML Builder by default to build RSS and ATOM feeds, but nothing to help you build complex and custom JSON data structures. JSON Builder is here to help.
\ but i don't want to include "staff" etc. i just want a json with an array directly as i mentioned above can you pls. teach me how, as i've said i'm new to ruby and rails.
thanks.
hi, i'm very new to rails(and ruby). was wondering how i can get the following output in rails:
[ { "first": "Garrett", "last": "Bjerkhoel" }, { "first": "John", "last": "Doe" } ]
\ if i do something like
Staff @users do |user| first user.firstname last last:lastname end
\ it will give me something like:
{ "staff":[ { "first": "Garrett", "last": "Bjerkhoel" }, { "first": "John", "last": "Doe" } ] }
\ but i don't want to include "staff" etc. i just want a json with an array directly as i mentioned above can you pls. teach me how, as i've said i'm new to ruby and rails. thanks.