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

86
Views
convertir una matriz anidada profunda de objetos en una cadena simple separada por tabulaciones

Tengo JSON anidado de tres niveles o más. Necesito convertirlo en una cadena de aspecto agradable.

por ejemplo

 let a = { "spec":[ {'key': 'General', 'values': [ {'key': 'Model Number', 'value': 'REDMI'}, {'key': 'Year of Manufacture', 'value': '2022'}, {'key': 'SIM Type', 'value': 'Dual Sim'} ]}, {'key': 'OS & Processor Features', 'values': [ {'key': 'Operating System', 'value': 'Andriod' }, {'key': 'Processor Type', 'value': 'MediaTek' }, {'key': 'Processor Core', 'value': 'Octa Core' }, {'key': 'PCS', 'value': '2 GHz' }, ] } ] }

en algo como esto

General
Número de modelo: REDMI
Año de Fabricación : 2022
Tipo de SIM: Dual Sim
Características del sistema operativo y del procesador
Sistema Operativo: Andriod
Tipo de procesador: MediaTek
Núcleo del procesador: Octa Core
PCS', 'valor': '2 GHz\

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

0

Aquí tienes:

 let a = {...} let formattedText = "" for (let spec of a["spec"]) { formattedText += spec["key"] + "\n" for (let value of spec["values"]) { formattedText += `\t${value["key"]} : ${value["value"]}\n` } } return formattedText
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!