I'm trying to convert a txt to json fomat in Javascript,if I put the txt in 1 line as following code ,it works good:
<html>
<body>
<p id="demo"></p>
<script>
const txt = '{"name":"John", "age":30, "city":"New York","home":"yes"}'
const obj = JSON.parse(txt);
document.getElementById("demo").innerHTML = obj.name + ", " + obj.age;
</script>
</body>
</html>
However in my real business ,the txt is very long ,and I have to start from new line ,I added '/n' :
<!DOCTYPE html>
<html>
<body>
<p id="demo"></p>
<script>
const txt = '{"name":"John", "age":30, "city":"New York", + "/n" +
"home":"yes"}'
const obj = JSON.parse(txt);
document.getElementById("demo").innerHTML = obj.name + ", " + obj.age;
</script>
</body>
</html>
But it not works,any friend can help ?