Skip to content

jhstatewide/streamingjsonparser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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_json_parser = 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.request_uri) do |res|
    res.read_body do |chunk|
       streaming_json_parser << chunk
       json_documents = streaming_json_parser.process
       if json_documents.length > 0
          do_something_interesting_with(json_documents)
       end
    end
end

About

This Ruby Gem handles the splitting of chunked JSON input.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published