The following is my code for converting Json string to object. Please suggest me any better and more reliable way.
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"
import="com.pks.UserBean"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<title>Insert title here</title>
</head>
<body>
This page contains data
<%
UserBean bean = (UserBean)(session.getAttribute("currentSessionUser"));
%>
s<h1><%String a = bean.getUserName(); %></h1>
<%= a %>
<script type="text/javascript">
alert("hELLO WORLD");
var my = '<%= a %>'
alert(my);
var obj = jQuery.parseJSON('{"name":"John"}');
alert( obj.name === "John" );
</script>
</body>
</html>