Skip to content

angleman/json-fix-stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json-fix-stream

Fix malformed JSON stream

Install 🔨

npm install json-fix-stream

Usage 💡

attandance.json

{"name":"joe", "city":"Portland", "comment":"this is great"}
{"name":"trouble", "city":"Near You", "comment":"i like to add
newlines in my
comments"}
split         = new require('split')("}\n") // parse json with newlines in attributes
jsonFixStream = new require('json-fix-stream') // fix the nixed } at the end of each line
inStream      = require('fs').createReadStream('attandance.json')
inStream.pipe(split).pipe(fix).pipe(process.stdout) // each record is sucessfully parsed and output

Contributions 💪

😄 Feedback, problem reports, enhancement requests are welcome.

🆙 Example code are better.

🆒 Pull requests are best.

License

MIT

About

Fix malformed JSON stream

Resources

License

Stars

Watchers

Forks

Packages

No packages published