knife
Parse JSON that's smushed together
why?
Imagine you have a TCP server that clients are sending JSON to. At fast paces, you can't know if the end of the message is actually the end of the JSON object.
Instead of searching for a delimiter or control character, why not continually parse it?
install
npm install knife
example
var knife = ; var testObj = lol: 'wut' var goodJSON = JSON badJSON = goodJSON + goodJSON; console;
knife.parse(uglyStuff, debug = false)
will always return
results: {} {} ... remainder: ''