I've searched the internet for an answer and what I found was that JSON.stringify() cannot convert for example functions, only pure data.
But this answer couldn't fulfill my need.
I need to save the json I requested via fetch in a string because of how AsyncStorage works
So I take the jsonContent and save it as a stringified version (jsonContent is the fetched json)
var temp = JSON.stringify(jsonContent);
Then later I need to recall it so I return it back to it's json format, but it does not accept the output as a json output.
var output = JSON.parse(temp);
The json I wanna fetch is:
{
"content": [{
"name": "this",
"desc": "is",
"explanation": "just a",
"time": "test",
"class": "with one",
"image": "item",
"id": "0",
"l_name": "testing"
}]
}
The fetched version of jsonContent (This is useable, pre-stringify&parse):
Object {
"content": Array [
Object {
"class": "with one",
"desc": "is",
"explanation": "just a",
"id": "0",
"image": "item",
"l_name": "testing",
"name": "this",
"time": "test",
},
],
}
The fetched version of jsonContent (This is not useable, post-stringify&parse):
Object {
"content": Array [
Object {
"class": "with one",
"desc": "is",
"explanation": "just a",
"id": "0",
"image": "item",
"l_name": "testing",
"name": "this",
"time": "test",
},
],
}
How do i fix my json so I can use JSON.stringify(JSON.parse(jsonContent))
If you need anymore information, just ask. Thank you for your time.
