StreamingJSONParser
====================================
Synopsis
StreamingJSONParser allows you to receive JSON in chunks from a webserver
and easily extract (hopefully) well formed JSON.
This gem was developed to interface to Riak.
Example
streaming
jsonparser = StreamingJSONParser.new
uri = URI.parse("http://example.com/json_stream")
http = Net::HTTP.new(uri.host, uri.port)
# mmm, chunky HTTP
http.request
get(uri.requesturi) do |res|
res.read_body do |chunk|
streaming
jsonparser << chunk
json
documents = streamingjson_parser.process
if json_documents.length > 0
do
somethinginteresting
with(jsondocuments)
end
end
end