mirror of
https://github.com/langgenius/dify.git
synced 2026-01-13 21:57:48 +08:00
11 lines
178 B
JavaScript
11 lines
178 B
JavaScript
export const cleanJsonText = (text) => {
|
|
const cleaned = text.replaceAll(/,\s*\}/g, '}')
|
|
try {
|
|
JSON.parse(cleaned)
|
|
return cleaned
|
|
}
|
|
catch {
|
|
return text
|
|
}
|
|
}
|