dewski / json_builder

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.
http://garrettbjerkhoel.com/json_builder/
MIT License
244 stars 52 forks source link

error while JSONP callbacks #12

Closed ywencn closed 12 years ago

ywencn commented 12 years ago

I ran the dummy app in spec/dummy and i add callback=? to the params, then i got

ActionView::Template::Error (387: unexpected token at 's({"id": 1, "name": "Garrett Bjerkhoel", "email": "me@garrettbjerkhoel.com", "url": "/users/1", "help": "yes", "created_at": "2011-11-29T19:50:32Z", "updated_at": "2011-11-29T19:50:32Z", "deep": s({"included_helper": "yes", "node": "yes", "url": "/"})}), s({"id": 2, "name": "Jake Bellacera", "email": "jake@jakebellacera.com", "url": "/users/2", "help": "yes", "created_at": "2011-11-29T19:50:58Z", "updated_at": "2011-11-29T19:50:58Z", "deep": s({"included_helper": "yes", "node": "yes", "url": "/"})})]'):

dewski commented 12 years ago

Thanks for this, I will look into it and let you know when it's been fixed.

dewski commented 12 years ago

I have pushed a fix up to master, can you check this out locally and test to make sure this is fixed for you? My tests are returning the expected JSON result. If it is not working for you again, can you provide a trace and the version of Ruby you are running?

ywencn commented 12 years ago

it works well now, thank you! It's a great gem!