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

209
Views
Create JSON with wrapped name in javascript?

For example i have JSON like this

{
    "1":"12",
    "2":"13",
    "3":"14"
}

How can i wrap them like

"data":{
    "1":"12",
    "2":"13",
    "3":"14"
}

Any lib we can do this ? Thank you a lots

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

0

const json = `{
  "1": "34.4",
  "dog":"Snoopy",
  "more": [ 1, 2, 3, 4 ]
}`

const myObj = {
  data: JSON.parse(json)
}

console.log(myObj);

Simply that would do it. JSON is simply a string format, representing a javascript object. So within myObj, I can assign that to an object property and parse that JSON string into an object.

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!