diff --git a/examples/README.md b/examples/README.md index 4c69cc6..454c1f2 100644 --- a/examples/README.md +++ b/examples/README.md @@ -50,6 +50,8 @@ Return JSON object for each one: { "name": "Mercury", "position": 1, "description": "Mercury is ..." } Between each response, say "NEXT" to clearly delineate each JSON response. + +Don't say anything else except the JSON objects above. ``` The code in the repo uses the `NEXT` token to know when to process the JSON object. diff --git a/examples/streaming-to-json-objects.rb b/examples/streaming-to-json-objects.rb index 4acf89b..f54f1ca 100755 --- a/examples/streaming-to-json-objects.rb +++ b/examples/streaming-to-json-objects.rb @@ -49,6 +49,8 @@ { "name": "Mercury", "position": 1, "description": "Mercury is ..." } Between each response, say "NEXT" to clearly delineate each JSON response. + + Don't say anything else except the JSON objects above. TEXT # Handle each JSON object once it has been fully streamed @@ -63,7 +65,7 @@ def call(content) json = JSON.parse(@buffer) # do something with JSON, e.g. save to database - pp json + puts json.to_json # reset buffer @buffer = ""