Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

115
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda