diff --git a/app/components/record/RecordField.tsx b/app/components/record/RecordField.tsx index 155ed07b..174613e0 100644 --- a/app/components/record/RecordField.tsx +++ b/app/components/record/RecordField.tsx @@ -55,6 +55,18 @@ export const AttributeValue: React.FC = ({ field, style, s ) } +const isJsonString = (value: string) => { + if (typeof value !== 'string' || Number(value)) { + return false + } + try { + JSON.parse(value) + } catch (e) { + return false + } + return true +} + const RecordField: React.FC = ({ field, hideFieldValue = false, @@ -92,19 +104,7 @@ const RecordField: React.FC = ({ }, }) - const isJSON = (text: string) => { - if (typeof text !== 'string') { - return false - } - try { - JSON.parse(text) - return true - } catch (error) { - return false - } - } - - if (isJSON(field?.value)) { + if (isJsonString(field?.value)) { return }