I have JSON that I want to display in a tag on my submitted.erb but I can't get it to display. When I PUT the JSON, I see the entirety of the parsed JSON in the console.
Here's the flow:
put '/' do
require json
...
@resp = JSON.pretty_generate(JSON.parse(json))
redirect "/submitted/"
end
get '/submitted/?' do erb :submitted, :locals => {:results => @resp} end
Then in my submitted.erb I have <%= results %> in my pre tags.
If you want to output the string version of your object in erb you can do
<%= results.inspect %>
But you probably just need it as a string so try change
@resp = JSON.pretty_generate(JSON.parse(json))
to
@resp = JSON.parse(json).to_s