-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serializer streaming in Rails #7
Comments
Yes that's the kind of thing I want to_json to support, streaming large results was a primary consideration in the design. When I first wrote to_json the stream support wasn't in Oj but now its there it should be possible to wire it up to the controllers response.stream I plan to do a bit of work on to_json this coming week to add as an official gem so I will also look at adding the streaming suport if you would be happy to try it with rails in your app/environment. |
@ahacking I would be glad to try it out in my app for sure.
|
That's very much how it will work, I need to add support for setting up Oj with a stream in the to_json initializers. Currently it just initializes an Oj context using a string buffer serializer. It will be a very simple addition and I'll get onto it once I'm back at my office as I'm away having a break from work currently. |
Sounds great. Have a good break :-) |
Hi,
The README talks about this library's ability to stream the JSON generation. Is there a way to take advantage of this in my Rails 4 controllers, and stream the response JSON straight from the serializer? Currently what happens is I call
json!
and render the resulting JSON string...but that can be very large, and it might be beneficial to take advantage of Rails 4'sActionController::Live
abilities.What do you think?
Here's an example of
ActionController::Live
: http://www.sitepoint.com/streaming-with-rails-4/The text was updated successfully, but these errors were encountered: