We would like to know how to wrap String into JSON string.
<!DOCTYPE html>
<html>
<body>
<script type='text/javascript'>
<!-- w w w . jav a2 s.com-->
var str = '"test":"abc","test1":"hello,hi","test2":"hello,hi,there"';
var obj = JSON.parse('{'+str+'}');
document.writeln(obj.test1);
</script>
</body>
</html>
The code above is rendered as follows: