I need to show a JSON received from the server on a web page, but the JSON is in string format and seems to have been escaped during creation. Upon checking the details in the console, it throws an error:
Uncaught SyntaxError: Unexpected token in JSON at position 67
at JSON.parse (<anonymous>)
at displaySmsDetails (sms.html:108)
at <anonymous>:1:1
Even after using various JSON validators, no invalid characters are found in the JSON.
function displaySmsDetails(){
var temp='[{"date":"1589952101314","number":"989999920000","body":"بانك سامان\nبرداشت مبلغ 100,000 خريدکالا\nاز 873-1\nمانده 1,676\n1399/2/31\n09:51:35","type":"inbox"}]';
var list=JSON.parse(temp);
$("#details").html(JSON.stringify(list));
}
displaySmsDetails()
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="details"></div>