I am currently using Socket.IO to transmit data to the browser. The information being sent is a continuous stream of JSON objects, which upon arrival at the browser, transforms into a single large JSON string. However, the issue I am encountering is that this JSON string cannot be parsed by JSON.parse() due to its unconventional format.
Since the structure of the data can vary greatly, utilizing RegEx may not provide a viable solution. Additionally, it is important to note that the current setup is only temporary. Eventually, the server will preprocess the JSON stream before sending it to the browser, eliminating the need for a real-time stream. Therefore, I prefer to maintain the existing AJAX/Socket.IO configuration rather than switching to a JSON stream parser like OboeJS.
Is there a workaround to effectively parse this concatenated JSON string?
To clarify, the JSON will have the following structure:
{"a":"A"}{"b":"B"}{"c":"C"}
My objective is to parse it in a manner that allows me to access the individual elements as follows:
console.log(Object.a) //A
console.log(Object.b) //B
console.log(Object.c) //C