137
rated 0 times
[
139]
[
2]
/ answers: 1 / hits: 20198
/ 8 Years ago, wed, december 7, 2016, 12:00:00
I have a react application in which I want the user to be able to upload code files that he can then view.
So naturally, .json files are also accepted. Now to get the file contents, I use axios to make a get request to the file on the server.
This works fine for everything except JSON files, which are automatically parsed and therefore not available as a String, but as a javascript object. Turning them into a string again with JSON.stringify
removes all line breaks, so I can't do that.
Is there any way to stop Axios from automatically parsing JSON?
More From » json