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

Loading…
Cancel
Save