Javascript examples for jQuery:Json
wrap json in json field like a string
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.8.3.js"></script> <script type="text/javascript"> $(function(){//from ww w. j a va 2 s . com var foo = { field1: 1, field2: "someValue" }; var foos = JSON.stringify(foo); var bar = { requestBody: foos }; var bars = JSON.stringify(bar); $("#d").text(bars); }); </script> </head> <body> <div id="d"></div> </body> </html>