Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

112
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda