File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
adminforth/spa/src/components Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -129,8 +129,11 @@ const columnError = (column: AdminForthResourceColumnCommon) => {
129129 }
130130 }
131131 if (column .type === ' json' && ! column .isArray ?.enabled && currentValues .value [column .name ]) {
132+ const value = currentValues .value [column .name ];
132133 try {
133- JSON .parse (currentValues .value [column .name ]);
134+ if (typeof value === ' object' ) {
135+ JSON .parse (JSON .stringify (value ));
136+ }
134137 } catch (e ) {
135138 return t (' Invalid JSON' );
136139 }
@@ -286,10 +289,11 @@ onMounted(() => {
286289 }
287290 }
288291 } else if (currentValues .value [column .name ]) {
289- currentValues .value [column .name ] = JSON .stringify (currentValues .value [column .name ], null , 2 );
292+ if (typeof currentValues .value [column .name ] !== ' string' ) {
293+ currentValues .value [column .name ] = JSON .stringify (currentValues .value [column .name ], null , 2 )
294+ }
295+ }
290296 }
291-
292- }
293297 });
294298 emit (' update:isValid' , isValid .value );
295299});
You can’t perform that action at this time.
0 commit comments