pub fn remove_trailing_commas(json: &str) -> StringExpand description
Removes trailing commas before closing brackets.
Handles patterns like: {"a": 1, "b": 2,} → {"a": 1, "b": 2}.
0.20.0 K1: tracks string state so a comma inside a string literal (e.g.
{"a": "x, }"}) is kept — it is content, not a trailing comma. Mirrors the
in-string/escape state machine used by extract_bracket_pair /
fix_unescaped_quotes; without it the old version corrupted string values
whose text ended with a comma followed by }/].