json-around
Put a JSON string around an object stream.
Example
Given this code
var through = ;var jsonAround = ; var source = through; source ; source;source;source;source;
stdout will (roughly) get
{
"location": "farm",
"animals": [
{"name":"horse"},
{"name":"dog"},
{"name":"cow"}
]
}
and it would have been streamed in chunks like
{"location":"farm","animals":[
{"name":"horse"},
{"name":"dog"},
{"name":"cow"}]}
API
jsonAround(arrayPropertyName, wrapperObject)
arrayPropertyName
String to use for the array's key in resulting JSON.
wrapperObject
Object that will be converted to JSON and have array added to it.
returns a through stream
Objects piped in will become elements of the array.
Output is chunks of json.
Install
npm install json-around
License
MIT