Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
JSON parser error with jqGrid 3.6.5
20/05/2010
02:45
Avatar
glittle
Member
Members
Forum Posts: 31
Member Since:
23/01/2010
sp_UserOfflineSmall Offline

Hi,

I had a working site, then updated to version 3.6.5. (Also updated JQuery to 1.4.2 and JQueryUI to 1.8.1.)

Now, when I load my grid, the 'loadError' event triggers, and I get:

        status    "parsererror"

        error    "Invalid JSON: {records:4558,total:456,page:1,rows:[{id:'45600',cell:['1','56453'....."

                     (Contents of the JSON are excluded, as it is too big, and confidential...)

When monitoring the response using Fiddler with a JSON inspector, I can see that the JSON is valid...

As a test, I simply replaced the 3.6.4 version of JQGrid and it worked fine!

Please advise!

Glen

21/05/2010
23:16
Avatar
glittle
Member
Members
Forum Posts: 31
Member Since:
23/01/2010
sp_UserOfflineSmall Offline

Here is the complete contents of a much shorter JSON response from the server:

{records:0,total:0,page:1,where:'Country is Bermuda, and Location is Boston',whereJson:'{"Country":["BMU"],"Location":["Boston"]}',rows:[]}

Even this response results in an "Invalid JSON" error.

22/05/2010
09:13
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

HEllo,

You can look here:

http://www.trirand.com/jqgridw.....4_to_3.6.5

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

22/05/2010
09:47
Avatar
glittle
Member
Members
Forum Posts: 31
Member Since:
23/01/2010
sp_UserOfflineSmall Offline

Thanks... this will help a lot.

More questions:

1) Please confirm: the JSON used in coding and the JSON used in the data work must be formatted differently?

2) Could you also elaborate on what this is referring to:  "the so named “d” property from the response (used in certain systems)."

What 'certain systems' is this referring to?  If I have complete control over the JSON sent to the browser, do I have to worry about this?

3) "With version 3.6.5 we switch from ajax complete to ajax success event" --> Does this have any impact on my coding, especially in the handlers for 'loaderror', 'loadcomplete', etc. ?

4) This change to how JSON data is processed was not mentioned in the 'jqGrid 3.6.5 changes and fixes', yet is a major breaking change. I would expect that most current implementation will break when converting.  Are there other changes that we should be aware of?

Thanks,

Glen

22/05/2010
09:56
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

This is a needed change.

You will get the same error if you use jQuery 1.4 and use getJSON - just try - more info you can find here:

http://api.jquery.com/jQuery.getJSON/

See Important notes.

The d property is used in some Microsoft Systems.

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

22/05/2010
10:07
Avatar
glittle
Member
Members
Forum Posts: 31
Member Since:
23/01/2010
sp_UserOfflineSmall Offline

For the record, in case others wonder about this...

From the JQuery site linked by Tony:

JSON is a data-interchange format with syntax rules that are stricter than those of JavaScript's object literal notation. For example, all strings represented in JSON, whether they are properties or values, must be enclosed in double-quotes. 

I was not clear on the difference between the 'object literal notation' and 'JSON'... I thought they were the same thing, but see now that they are similar, but different.

And, as per the  www.json.org web site, all strings must be quoted, but values such as numbers and booleans should not be quoted.

Thanks Tony!

25/05/2010
19:49
Avatar
glittle
Member
Members
Forum Posts: 31
Member Since:
23/01/2010
sp_UserOfflineSmall Offline

Another entry, to help others...

I had this line in my .jqGrid() initializer:

 loadComplete: function(response) {
      ShowInfo(jQuery.jgrid.parse(response.responseText));
    },

Now, with version 3.6.5, I no longer have to parse the response, since it is already a Javascript object:

 loadComplete: function(response) {
      ShowInfo(response));
    },

28/05/2010
09:35
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Thanks for this. We should add it to the documentation.

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

27/09/2012
18:18
Avatar
bailamj
Member
Members
Forum Posts: 3
Member Since:
27/09/2012
sp_UserOfflineSmall Offline

tony said:

Hello,

This is a needed change.

You will get the same error if you use jQuery 1.4 and use getJSON - just try - more info you can find here:

http://api.jquery.com/jQuery.getJSON/

See Important notes.

The d property is used in some Microsoft Systems.

Regards

Tony


this url no working 😉

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
54 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information