Skip to content

Commit

Permalink
fixed bug in jsonenditor when working in text mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ck-c8y committed Sep 27, 2023
1 parent e0b80fc commit e7a84a9
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {
JSONContent,
isMultiSelection,
createMultiSelection,
TextContent,
} from "vanilla-jsoneditor";

@Component({
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit e7a84a9

Please sign in to comment.