Skip to content

Instantly share code, notes, and snippets.

@jgraup
Last active January 3, 2016 01:09
Show Gist options
  • Save jgraup/8387155 to your computer and use it in GitHub Desktop.
Save jgraup/8387155 to your computer and use it in GitHub Desktop.
JS-Common.js
<!-- JSON -->
<script id="myJson" type="application/json">{"name":"foo"}</script>
<!-- Load JSON -->
<script type="text/javascript">
(function(){
var obj = jQuery.parseJSON($('#myJson').html());
console.log(obj.name); //Foo
var json = JSON.stringify(obj);
console.log(json); // {"name":"foo"}
})();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment