I've been looking for some time for a way to send JSON over a tcp socket and to de-serialize it into an object. The problem that I'm having is that when my message is too big, TCP chunks it. By doing this, my clients are receiving only a piece of the JSON and the parser sends that part and the following as malformed JSONs.
I'm trying to look for a tool that will allow me to feed it with this partial views of my JSON. The first time, my buffer contains only a partial JSON, I send it to the parser and it returns something that indicates that the JSON is not finished. Next time, when I append the new information to the buffer, the parser continues from the last point of where it was and finds the end of the JSON message (Or waits in case is needed and the JSON is coming in more than two chunks) and return something with the information of that JSON content, and removes it from the buffer, where the next information coming form the stream will be appended.
So far, I found that some other ideas but for other languages (Java in this one: Is there a streaming API for JSON?)