简体   繁体   中英

Generate JSON file using JavaScript code

I'm new to Web Development and just created a simple form in HTML and using some JavaScript I can submit the form by HTTP Post. I wanted to know whether there is a way to generate a JSON file with JSoN objects in it and then upload it to a JSON based database like firebase? Thanks

Short answer: yes, just use var json = JSON.stringify(array);

Long answer: You need an array, or better: an object array. If you assign keys it will be much easier to work on serverside. However just stringify the array and you are done.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM