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_TopicIcon
JSON Formatting
03/09/2008
19:03
Avatar
Pete
Member
Members
Forum Posts: 100
Member Since:
01/09/2008
sp_UserOfflineSmall Offline

I noticed a difference in the json format that jqgrid uses and the one I see (and have used) as an example at the "official" json site:

http://www.json.org/example.html

The difference is subtle but important.  In "standard" json the format is something like:

{"menu": {
  "id": "file",
  "value": "File",
  "popup": {
    "menuitem": [
      {"value": "New", "onclick": "CreateNewDoc()"},
      {"value": "Open", "onclick": "OpenDoc()"},
      {"value": "Close", "onclick": "CloseDoc()"}
    ]
  }
}}
 
In jqgrid you expect:
 
{menu: {
  id: "file",
  value: "File",
  popup: {
    menuitem: [
      {value: "New", onclick: "CreateNewDoc()"},
      {value: "Open", onclick: "OpenDoc()"},
      {value: "Close", onclick: "CloseDoc()"}
    ]
  }
}}
 
In this case, jqgrid doesn't have quotes around the lefthand argument. 
That causes me problems because I use flexjson in my java code to properly 
format my java POJO's into a json string and the format that jqgrid uses is 
not the same as the "standard" json. 
 
Perhaps a parameter in the jsonReader setting to tell the reader to expect
quotes around the left hand arguments and some code to handle it would be 
a good idea.  Something like "jsonQuoted: true" in the jsonreader.  If I was 
more familiar with Javascript I might be able to make the change myself. It 
*would* make it "json standards" compliant I think. 
 
Just a suggestion 
04/09/2008
04:19
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

Do you have checked the *standart* way?

I think it shouldl work, since after getting the json data I make a standart

javascript eval on the request which bring you to what you want.

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.

04/09/2008
17:12
Avatar
Pete
Member
Members
Forum Posts: 100
Member Since:
01/09/2008
sp_UserOfflineSmall Offline

Tony,

I thought I had tested this a few times and all I can think of is that I had a syntax problem that was the cause, not the quoted string problem.

So, I have re-tested the application with a "standard" json format and it seems to work just fine so I will go back to using flexjson again.

Sorry about that!  My apologies for not checking my assumptions.

Pete

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
56 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