Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

111
Views
json-editor ignores starting value

I am trying to utilize https://github.com/json-editor/json-editor. I have read all documentation and examples multiple times and I cannot get the editor to respect my starting values (startVal). The editor is created using my schema, but the editor is not initialized with the starting object I am providing. Here is my code:

  $.get("/AppAdmin/GetWorkflowEditSchema", {}, function (schemaResponse) {

      if (schemaResponse) {

        var editSchema = JSON.parse(schemaResponse);

        $.get("/AppAdmin/GetWorkflow?workflowName=" + workflowToEdit, {}, function (workflowResponse) {

          if (workflowResponse)
          {
            var workflow = JSON.parse(workflowResponse);

            const holder = document.getElementById("workflowEditorHolder");

            var options = {
              "schema": editSchema,
              "startVal": workflow,
              "theme": "bootstrap4"
            };
    
            jsonEditor = new JSONEditor(holder, options);
          }
          else {
            toastr.error("The workflow could not be loaded to edit.");
          }
        });

      }
      else {
        toastr.error("Reading edit schema failed.");
      }

Both server responses are the correct JSON strings. When I copy and paste my schema and starting object into the json-editor interactive playground at https://pmk65.github.io/jedemov2/dist/demo.html, the editor is created with the correct starting values. So I suspect something is wrong with my objects. I am very unfamiliar with JSON so that would not be surprising.

Here is my schema:

schema

And the object I am trying to initialize the editor with:

object

What am I doing wrong? Thank you for any help.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I got this working by using setValue() after creation instead of passing the initializing object:

            var options = {
              "schema": editSchema,
              // "startVal": workflow,
              "theme": "bootstrap4"
            };
    
            jsonEditor = new JSONEditor(holder, options);
            jsonEditor.setValue(workflow);

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!