Answers for "es6 convert string to json"

6

js string to json

var obj = JSON.parse("{no:'u',my:'sql'}");//returnes {no:'u',my:'sql'}
Posted by: Guest on April-08-2020
2

json parse

<!DOCTYPE html>
<html>
<body>
<h2>Convert a string into a date object.</h2>
<p id="demo"></p>
<script>
var text = '{"name":"John", "birth":"1986-12-14", "city":"New York"}';
var obj = JSON.parse(text);
obj.birth = new Date(obj.birth);
document.getElementById("demo").innerHTML = obj.name + ", " + obj.birth; 
</script>
</body>
</html>
Posted by: Guest on January-13-2021

Code answers related to "es6 convert string to json"

Code answers related to "Javascript"

Browse Popular Code Answers by Language