If a string contains only JSON, or has a single JSON code section which start the string, it can be autodetected so specific stream parsing is not needed. Initial stream parsing is needed if:
- the JSON does not start the string, but has other non-JSON content before it.
- the there are several discrete sections of JSON code embedded in the string and a specific section is needed.
In these scenarios, normal string parsing operators can be used to advance the stream parsing cursor to the start of the desired code and then use String.captureJson(), to capture the whole JSON code segment detected at that point. Note the code is only ever of one continuous section of JSON code even if others lie further along in the stream after other sections of non-code text.
See more on JSON processing.