Microsoft JScript runtime error: 'e.JSON' is null or not an object

Feb 18, 2011 at 4:33 AM

The subject is all I ever get when I use this thing against a WCF Data Service. 

<BODY OnLoad="x()">
	<script type="text/javascript" src="jquery.js"></script>
	<script type="text/javascript" src="datajs.js"></script>
	<SCRIPT type="text/javascript">
	function x( ) {
		OData.defaultHttpClient.enableJsonpCallback = true;"http://localhost:50517/TestData.svc/pressrelease?$top=5&$select=DateLine,HeadLine&$orderby=DateAndTime desc",
		  function (data, request) {
			var html = "";
			for (var i = 0; i < data.results.length; i++) {
				html += "<p>" + data.results[i].HeadLine + "</p>";
			document.getElementById("odataDiv").innerHTML = html;
	<DIV id="odataDiv">

Feb 18, 2011 at 6:00 AM

Hi cosmokenney,

What browser and version are you using? If it's IE6 or IE7 (or greater version in compatibility mode), they do not have native JSON support so you’ll need to add an additional script reference to

<script type="text/javascript" src="></script>

If that doesn’t resolve the issue, please let me know.


Feb 18, 2011 at 7:50 PM

Brilliant! Thank you. 

I want to apologize. I've been working with Windows Forms and WPF apps for years, It's as if I'm starting over on the web :-(

Thanks for the easy fix.