简体   繁体   中英

how to make the editor text to get the data same as json data using angular2 or typescript

i have a json data but when it is assigned to the editor it is missing the quotes, so can anyone help me how to get the quotes also to the editor.

ts code:

this.product
      .getproduct(t)
      .subscribe(
        products => {
          let editorOptions = {
            showJSONEditorTab: true
          };
        }),

  }

Here im getting the console.log(this.survey_val) output like this:

{"pages":[{"name":"page1"]} 

console.log(this.editor.text);

   {
 pages: [
  {
   name: "page1",
     ]
    }

I got it working by giving,

let editorOptions = {
            showJSONEditorTab: true, generateValidJSON : true
          };

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM