Edit in JSFiddle

$(document).ready(function(){
       var el = document.createElement('script');
       el.type = 'application/ld+json';
       el.text = JSON.stringify({ "@context": "http://schema.org",  "@type": "Recipe", "name": "My recipe name" });

document.querySelector('head').appendChild(el);
});

<!DOCTYPE html>
<head>
<meta property="og:image" content="myimage.jpg"/>
<title>JSON-LD for a receipe</title>
<!-- this script is needed outside jsfiddle
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
-->
</head>
<body><div>
content of page

</div>
</body>
</html>

              

External resources loaded into this fiddle: