I'm sending an object from Javascript to a Sinatra POST route. I'm using the 'stringify' method to convert my js object to JSON. The JSON being sent is like so (according to the dev tools in chrome):
{"a":1,"b":2,"c":"3"}:
I have my route in Sinatra setup like so:
post '/results' do
results = JSON.parse(params.to_json, symbolize_names: true)
end
I can't figure how to access the keys in Ruby once I parse the JSON. Is there a better way to do so, am I missing something?