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

84
Views
Cadena a objeto de matriz en javascript

Tengo una cadena como esta:

 var x = "[{"id": "40", "text": "Budi "}, {"id": "47", "text": "Staff 01"}]"

Espero recorrer hasta el final y leer la identificación y el texto uno por uno, ¿cómo hacer esto en javascript?

He intentado a continuación:

 var myArr = JSON.parse(x); for (var i in myArr) { alert(myArr[i]); }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Su JavaScript no es válido. Asegúrate de envolverlo entre comillas simples.

 var x = '[{"id": "40", "text": "Budi "}, {"id": "47", "text": "Staff 01"}]' var myArr = JSON.parse(x); for (var i in myArr) { console.log("id: " + myArr[i].id); console.log("text: " + myArr[i].text); }

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!