Open HaritzPuerto opened 9 years ago
You can simply create json object by using .to_json and response json by using render :json. for example, in the end of your controller's action, json_hash = {} json_hash["key"] = "value" render :json => json_hash.to_json
it will response json data.
It will help you. http://guides.rubyonrails.org/layouts_and_rendering.html#rendering-json
Hello!
I don't know how to create responses in JSON, the book I'm using to learn Rails doesn't explain it. So I asked the TAs and they gave the following link: http://stackoverflow.com/questions/12385345/how-to-send-simple-json-response-in-rails If you know any other website with info about it, you can post it here! Hope it helps!
Thnx!
Haritz