Skip to main content

split_concatenated_jsonl

Function split_concatenated_jsonl 

Source
pub fn split_concatenated_jsonl(content: &str) -> String
Expand description

Split concatenated JSON objects in JSONL content that lack newline separators.

VS Code sometimes appends delta operations (kind:1, kind:2) onto the end of a JSONL line without inserting a newline first. This produces invalid JSONL like: {"kind":0,"v":{...}}{"kind":1,...}{"kind":2,...}

This function inserts newlines at every }{"kind": boundary to restore valid JSONL. The pattern }{"kind": cannot appear inside JSON string values because {"kind": would need to be escaped as {\"kind\": within a JSON string.