Is there any such thing as a JSON stream equivalent to YAML document
streams?
If not, how might such be accomplished?
Is there any such thing as a JSON stream equivalent to YAML document
streams?
If not, how might such be accomplished?
Thomas S. wrote in post #1023829:
Is there any such thing as a JSON stream equivalent to YAML document
streams?
What CouchDB does for its continuous changes feed is just to send one
JSON document per line, with a newline terminator. Then you can do:
while line = gets
data = JSON.parse(line)
… do something with data
end
Of course this means that the JSON you send must not be pretty-printed,
and also any embedded newlines within strings are encoded as \n, which
the JSON spec allows.
HTH,
Brian.
On Sep 26, 3:24pm, Brian C. [email protected] wrote:
… do something with data
endOf course this means that the JSON you send must not be pretty-printed,
and also any embedded newlines within strings are encoded as \n, which
the JSON spec allows.
Awesome. That should work for my case too. If I need the data pretty
printed I use YAML anyway.
Thanks Brian.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs