diff --git a/packages/builder/src/components/backend/DataTable/RowFieldControl.svelte b/packages/builder/src/components/backend/DataTable/RowFieldControl.svelte
index 25ad67b52e..0d9ca3644b 100644
--- a/packages/builder/src/components/backend/DataTable/RowFieldControl.svelte
+++ b/packages/builder/src/components/backend/DataTable/RowFieldControl.svelte
@@ -6,16 +6,20 @@
Toggle,
TextArea,
Multiselect,
+ Label,
} from "@budibase/bbui"
import Dropzone from "components/common/Dropzone.svelte"
import { capitalise } from "helpers"
import LinkedRowSelector from "components/common/LinkedRowSelector.svelte"
+ import Editor from "../../integration/QueryEditor.svelte"
export let defaultValue
export let meta
export let value = defaultValue || (meta.type === "boolean" ? false : "")
export let readonly
+ $: stringVal =
+ typeof value === "object" ? JSON.stringify(value, null, 2) : value
$: type = meta?.type
$: label = meta.name ? capitalise(meta.name) : ""
@@ -40,6 +44,14 @@
{:else if type === "longform"}
+{:else if type === "json"}
+
+ (value = detail.value)}
+ value={stringVal}
+ />
{:else}
{
errors[fieldName] = "Field not in list"
}
})
+ } else if (type === FieldTypes.JSON && typeof row[fieldName] === "string") {
+ // this should only happen if there is an error
+ try {
+ JSON.parse(row[fieldName])
+ } catch (err) {
+ errors[fieldName] = [`Contains invalid JSON`]
+ }
} else if (type === FieldTypes.FORMULA) {
res = validateJs.single(
processStringSync(table.schema[fieldName].formula, row),