diff --git a/ui-ngx/src/app/shared/components/directives/tb-json-to-string.directive.ts b/ui-ngx/src/app/shared/components/directives/tb-json-to-string.directive.ts index ff8d2adead..dd2b79a044 100644 --- a/ui-ngx/src/app/shared/components/directives/tb-json-to-string.directive.ts +++ b/ui-ngx/src/app/shared/components/directives/tb-json-to-string.directive.ts @@ -26,6 +26,7 @@ import { Validator } from '@angular/forms'; import { ErrorStateMatcher } from '@angular/material/core'; +import {isObject} from "@core/utils"; @Directive({ selector: '[tb-json-to-string]', @@ -53,7 +54,11 @@ export class TbJsonToStringDirective implements ControlValueAccessor, Validator, @HostListener('input', ['$event.target.value']) input(newValue: any): void { try { this.data = JSON.parse(newValue); - this.parseError = false; + if (isObject(this.data)) { + this.parseError = false; + } else { + this.parseError = true; + } } catch (e) { this.parseError = true; } diff --git a/ui-ngx/src/app/shared/models/constants.ts b/ui-ngx/src/app/shared/models/constants.ts index 4bfce6414a..7eab516ef2 100644 --- a/ui-ngx/src/app/shared/models/constants.ts +++ b/ui-ngx/src/app/shared/models/constants.ts @@ -200,7 +200,7 @@ export const valueTypesMap = new Map( ValueType.JSON, { name: 'value.json', - icon: 'mdi:json' + icon: 'mdi:code-json' } ] ]