#push data of an API to local data.js file
10 messages · Page 1 of 1 (latest)
Are you just wanting to update the data.js file this one time, or do you need this ability as a feature in some app/webpage you're building? I'm not certain, but I don't believe JS running in browser is even capable of writing output to a file.
If the former, I would just console.log() the stringified JSON data from the API, then use a JSON linter (like jsonlint.com) to prettify it, then copy/paste that prettified JSON into the data.js file?
@pliant galleon I want the obj to save in a data.js file so that I can edit it and update it whenever the user wants to make a change to that data
if I want to change the name then I can use that locally saved data in the js file I can modify it and show it to the end user
@pliant galleon
I’m not following. Is the data from the API call the result of a user-specified search? And you want to display those search results to the page? If so, why would you need to write the data to a file?
Okay since i am getting the data from the api on user search but if the user think the data is incorrect or want to modify the data it's not possible in the api to modify it so i am thinking to add those data which i am getting in the new data.js file so that I can just show the user that the request is been made it's just for my project
@pliant galleon