README.md in json-streamer-0.4.0 vs README.md in json-streamer-0.5.0

- old
+ new

@@ -42,24 +42,24 @@ streamer = Json::Streamer::JsonStreamer.new(file_stream, 500) ``` ```ruby # Get objects based on nesting level -# First level will give you the full JSON, second level will give you objects within full JSON object, etc. -streamer.get(nesting_level:2).each do |object| +# Level zero will give you the full JSON, first level will give you data within full JSON object, etc. +streamer.get(nesting_level:1).each do |object| p object end ``` -Getting second level objects on the JSON below will yield you 2 empty objects - ```json { "object1": {}, "object2": {} } + => + {} {} ``` ```ruby @@ -75,18 +75,38 @@ "key" : "value" }, "key" : "value", "obj2" : { "key" : { - "key" : value" + "key" : "value" } } } + => + "value" "value" "value" -{"key"=>"value"} +{"key" : "value"} +``` + +```ruby +# You can also skip values if you'd only like to get objects and arrays +streamer.get(nesting_level:1, yield_values:false).each do |object| + p object +end +``` + +```json +{ + "obj1" : {} + "key" : "value" +} + +=> + +{} ``` Check the unit tests for more examples. ## Development