I have a serial port which I'm monitoring and occasionally JSON objects are published to it. The objects are not prepended with any kind of frame, so I simply need to catch when they do show.
There is some prior art at https://stackoverflow.com/a/3845829, but 1) it presumes that the string starts and ends with a correct JSON object, which isn't the case for monitoring an arbitrary serial port datastream; and 2) there's no direct C++ examples.
Furthermore, when trying with some arbitrary strings with embedded JSON Objects, such as {{"a": "a", "b": "b", "c": "c", "d": [3, 2, 3]}
, it fails to correctly find the object.
What is the correct approach for this? Regex? Something else?