In JavaScript, I am printing the values as
<script>alert('<%=status%>')</script>

Javascript error - Unterminated string constant.

In JSP I am getting status variable as <% status = instanceObj.get("status");%>

status value -
({
selected:null,
field:"[\r {\r name:\"shipmentno\", \r width:null\r }, \r {\r name:\"selection\", \r width:50\r }, \r {\r name:\"invoicenumber\", \r width:null\r }, \r {\r name:\"issuedate\", \r width:122\r }, \r {\r name:\"buyername\", \r width:null\r }, \r {\r name:\"buyercountry\", \r width:null\r }, \r {\r name:\"sellername\", \r width:null\r }, \r {\r name:\"sellercountry\", \r width:null\r }, \r {\r name:\"currency\", \r width:null\r }, \r {\r name:\"amount\", \r width:null\r }, \r {\r name:\"status\", \r width:null\r }, \r {\r name:\"substatus\", \r width:null\r }, \r {\r name:\"lastAction\", \r width:null\r }\r]",
sort:"({\r fieldName:null, \r sortDir:true\r})"
})

This is happening since, selected: , field: and sort: are coming on next line..

Please suggest some solution.