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

185
Views
Falta información del texto a JSON

Estoy trabajando en una versión modificada de esta aplicación.

Agregué diferentes tipos de enlaces al programa, quiero agregar qué tipo de enlace son los bordes en el documento JSON, pero cuando ingreso esta información como texto:

 {"nodes": [ {"id":2,"title":"1","x":181,"y":146}, {"id":3,"title":"2","x":608,"y":153}, {"id":4,"title":"3","x":153,"y":398}, {"id":5,"title":"4","x":548,"y":405} ] ,"edges": [ {"source":2,"target":3,"typeLink":"arrow"}, {"source":4,"target":5,"typeLink":"circle-full-blue"}, {"source":5,"target":3,"typeLink":"circle_square-hollow-blue"} ] }

Al documento json que sale le falta la información "typeLink":

0: Objeto { fuente: {...}, destino: {...} }

No modifiqué el código original, excepto el registro de la consola:

 d3.select("#upload-input").on("click", function(){ document.getElementById("hidden-file-upload").click(); }); d3.select("#hidden-file-upload").on("change", function(){ if (window.File && window.FileReader && window.FileList && window.Blob) { var uploadFile = this.files[0]; var filereader = new window.FileReader(); filereader.onload = function(){ var txtRes = filereader.result; console.log("#TXT : "); console.log(txtRes); // TODO better error handling try{ var jsonObj = JSON.parse(txtRes);//missing typeLink console.log("#JSON : "); console.log(jsonObj);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

También tuve este mismo problema antes, json to String format por alguna razón puede faltar información. Para arreglar esto:

JSON.stringify(json) => Convertirá json en formato String, no faltará información

JSON.parse(string) => Convertirá String en formato json, no faltará información

Intente usar esas funciones según las necesite y vea si eso funciona.

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!