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

138
Views
Convert formData to JSON object

I am trying to build a JSON object from a HTML form. My backend API accepts JSON only.

I try uing JSON.stringify but it give me a "1 level object" only. While I need a nested object just like how "multipart/form-data" works

For example I have a formData like this:

product[status]: 1
product[name]: Caesar Warm-Up Pant-32-Black
product[sku]: MP01-32-Black
product[price]: 35.00
product[tax_class_id]: 2
product[quantity_and_stock_status][is_in_stock]: 0

So I want my JSON looks like this

{
    product: {
        status: 1,
        name: "Caesar Warm-Up Pant-32-Black",
        sku: "MP01-32-Black",
        price: 35.00,
        tax_class_id: 2,
        quantity_and_stock_status: {
            is_in_stock: 0
        }
    }
}

Is there any wait to do it with plain javascript or any NodeJS package can do this?

Thank you

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!