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

159
Views
How can I convert a String value to number of an array object inside another array

I get a json data and one of the values in it is a String that I want to convert to number. I am dealing with two dimensional array and I am having difficulties to access the value.

This is my json:

 {
  "products": [
    {
      "id": "AAA",
      "description": "About AAA"
    },
    {
      "id": "BBB",
      "description": "about BBB",
      "values": [
        {
          "name": "CustomerB",
          "value": "1"
        },
        {
          "name": "CustomerB",
          "value": "3"
        }
      ]
    }
    ]
}

I need to convert value in values from String to number And here is how I try to use map

let newArray = products.map(product => {
        product.values.map(item => {
          ...item, value: parseInt(item.value)
        });
      });

But newArray is always undefined. How can I convert a value, string to number in two dimensional array without changing anything else?

about 4 years ago · Juan Pablo Isaza
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!