Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

how to export JAVASCRIPT data to a JSON file? PLEASE READ CAREFULLY: HI, I need help exporting the data in my javascript program into a

how to export JAVASCRIPT data to a JSON file? PLEASE READ CAREFULLY: HI, I need help exporting the data in my javascript program into a JSON file. I am able to do this find using LocalStorage.setitem and JSON.stringify, but the JSON file fails to download after a certain amount of data is added to my program, so I need a better solution than what I have. BELOW I WILL ATTACH MY CURRENT CODE AND A SOLUTION I SAW ON STACKOVERFLOW BUT DON'T KNOW HOW TO IIMPLEMENT FOR A JSON FILE.

MY CODE:

export default { components: { Icon, DataSheet },

data() { return { data: JSON.parse(localStorage.getItem('data') || '[]') } },

methods:

saveData() { localStorage.setItem('quotes', JSON.stringify(this.data)); },

importData() { $("#file_input").click() }

STACKOVERFLOW NON JSON SOLUTION:

$.ajax({ url: "/getData", dataType: "text", success: function(data){ $("#download").attr({ "value": "Download", "href": URL.createObjectURL(new Blob([data], { type: "application/octet-stream" })), "download": "outputFile.csv" }); } });

PLEASE HELP ME IMPLEMENT ABOVE SOLUTION FOR JSON FILE IMPORTING AND EXPORTING

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Azure SQL Database For Modern Developers Building Applications In The Microsoft Cloud

Authors: Davide Mauri, Silvano Coriani, Anna Hoffma, Sanjay Mishra, Jovan Popovic

1st Edition

1484263693, 978-1484263693

More Books

Students also viewed these Databases questions

Question

What are the classifications of Bank?

Answered: 1 week ago

Question

What are the logistics implications of internationalisation?

Answered: 1 week ago