diff --git a/mqtt-mapping-ui/mqtt-mapping/src/shared/editor2/jsoneditor2.component.ts b/mqtt-mapping-ui/mqtt-mapping/src/shared/editor2/jsoneditor2.component.ts index 0e88c355..3823b2b6 100644 --- a/mqtt-mapping-ui/mqtt-mapping/src/shared/editor2/jsoneditor2.component.ts +++ b/mqtt-mapping-ui/mqtt-mapping/src/shared/editor2/jsoneditor2.component.ts @@ -46,6 +46,7 @@ import { JSONContent, isMultiSelection, createMultiSelection, + TextContent, } from "vanilla-jsoneditor"; @Component({ @@ -177,9 +178,14 @@ export class JsonEditor2Component implements OnInit, OnDestroy { public get(): JSON { const content: Content = this.editor.get(); if (isJSONContent(content)) { - const c: any = (this.editor.get() as JSONContent).json; - return c; + const j: any = (this.editor.get() as JSONContent).json; + return j; + } else { + const t: any = (this.editor.get() as TextContent).text; + const j: JSON = JSON.parse(t) + return j } + } public set(json: any) {