Unable to get value of the property 'parse': object is null or undefined

2.6k views Asked by At

I'm trying to make a connection and download anything using oData format. The URL pointing to a service that I'm using returns a nice oData-ishly looking document. Now, I'd like to read in those contents into my JavaScript method and play with it for a while. I can't, though, due to the error that the property parse is not findable. That makes me sad.

According to this page (and a lot of others that I've found) the error in subject is caused by a non-available JSON parser. This issue is apparently a big deal for IE7 and below. But I'm on IE9 and IE10 and both experience the same issue. JSON support is supposed to be integrated into them by default.

  1. Can JSON support be turned off in IE10 and if so how?!
  2. How do I test if my browser, as of right now, right here, can handle JSON data?
  3. What more can be done to make my machine get the data?
  4. Could it matter that the service is on a CRM Dynamics 2011 server?

The code I'm executing to get there is below. It's fetched from the project's site for DataJS at this location. Of course, I've tested that the OData object exists and is accessible.

OData.read(
  "https://myurl/2011/OrganizationData.svc/crmk_CustomEntitySet",
  function(dataSet) { alert("Yippi!"); },
  function(errorMessage) { alert("Buuuu..."); }
});
2

There are 2 answers

0
Onno van der Zee On BEST ANSWER

You need to provide a doctype for IE9 to use the JSON object, like this:

<!DOCTYPE html>
<html>
     <head>...</head>
     <body>...
1
jbabey On

According to the faq page for datajs:

IE6 and IE7 (along with later versions run in compatibility mode) do not have native JSON support so you will need to add an additional script reference to json2.js.

The following is a simple script tag that can be included in the document head to address this. Another solution is to include the file in your own web server and refer to it locally.

<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js"></script>

If you're using IE7 or IE8, an alternative solution that I use is to add this in the first line of your page load event (assuming you're using .NET):

// switch to IE8 compatibility mode so that we have the JSON object in javascript
Response.AddHeader("X-UA-Compatible", "IE=8")