Browse Source

fix: use json stringify to avoid ending up with invalid json and removing unnecessary whitespace in key/value

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/6983/head
Pranav C 1 year ago
parent
commit
24afd2c362
  1. 8
      packages/nc-gui/components/cell/Json.vue

8
packages/nc-gui/components/cell/Json.vue

@ -72,13 +72,7 @@ const clear = () => {
const formatJson = (json: string) => {
try {
json = json
.trim()
.replace(/^\{\s*|\s*\}$/g, '')
.replace(/\n\s*/g, '')
json = `{${json}}`
return json
return JSON.stringify(JSON.parse(json))
} catch (e) {
console.log(e)
return json

Loading…
Cancel
Save