json-array-writable-stream
v1.1.2
Published
Packing objects into JSON array. ```javascript var json_array_writable_stream = require("json-array-writable-stream") var stream = json_array_writable_stream() stream.write(1) stream.write("string") stream.write(null) stream.write({a:"Aa"}) stream.write(v
Downloads
7
Readme
nodejs_json_array_writable_stream
Packing objects into JSON array.
var json_array_writable_stream = require("json-array-writable-stream")
var stream = json_array_writable_stream()
stream.write(1)
stream.write("string")
stream.write(null)
stream.write({a:"Aa"})
stream.write(void(0)) // Will ignore undefined by default
stream.end()
stream.pipe(process.stdout) // [1,"string",null,{"a":"Aa"}]
Available options:
var stream = json_array_writable_stream(
{
spaces: 0,
opening: "[",
closing: "]",
replacer: function(key, val) { return (key == "key1") ? "Replacement value." : val },
separator: ",\n",
replace_undefined_by: null // In case you want these keys to show up in your JSON.
})