Currently working on a new website and exploring some JavaScript functionalities. Being a beginner in this field, I apologize if my question seems basic :)
I have a JSON string with line breaks that are causing issues when trying to parse it into a JSON object. I attempted to remove the line breaks using:
stringJSON.replace(/(\r\n|\r|\n)+/, '');
However, despite applying this code, the line breaks still persist when I alert the string.
Any suggestions or alternatives?
Thank you in advance,
Wiwi :)
JSON:
[
{
"key0": "value 0",
"key1": "value 1",
"key2": "value 2"
},
{
"key0": "value 0",
"key1": "value 1",
"key2": "value 2"
}
]