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

80
Views
Multi element JSON object from JavaScript

I have a Javascript JSON object

const student = { name: "bob", age: 7, grade: 6 }

and I can pass it to my Web API using axios POST command by

JSON.stringify(student)

and I can build my student object by looping an array and passing in a value such as

let studentArr= []
const student = { name: studentArr[i]["name"], age: studentArr[i]["age"], grade: studentArr[i]["grade"}

I'm using i in the example as the index because it could have 100 students. As long as I pass in only one value for i, everything works fine. My question is how can I make it into a multi-element JSON object from my array. I've been spoiled by Newtonsoft.Json where I can pull data from a SQL database and create a JSON object. If I just JSON.stringify(studentARR) is shows empty. I want to pass to the Web API all of the students on one post so the Web API can make a document and download it back.

I seen many different ways of trying to accomplish this and the methods seem to change over time. Thanks for the help

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

0

Why do you have to JSON.stringify if you are using axios. The declaration of axios.post accepts URL as first parameter and the data which is formdata or the JSON object as second parameter

I'm pretty sure that you might not need to use JSON.stringify if you are using axios to post to a Web API

Example of using Axios post method https://axios-http.com/docs/post_example

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!