mirror of https://github.com/langgenius/dify.git
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
|
||
|
|
}
|
||
|
|
}
|