We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fa537a1 commit ea0ac61Copy full SHA for ea0ac61
1 file changed
src/services/jsonc.ts
@@ -1,6 +1,7 @@
1
/**
2
* Strips comments from JSONC content while respecting string boundaries.
3
* Handles // and /* comments, URLs in strings, and escaped quotes.
4
+ * Also removes trailing commas to support more relaxed JSONC format.
5
*/
6
export function stripJsoncComments(content: string): string {
7
let result = "";
@@ -79,5 +80,6 @@ export function stripJsoncComments(content: string): string {
79
80
i++;
81
}
82
- return result;
83
+ // Remove trailing commas before } or ]
84
+ return result.replace(/,\s*([}\]])/g, "$1");
85
0 commit comments