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 Badly Formatted--Help Please
05/03/2011
18:52
Avatar
bhogsett
Cleveland, Ohio, USA
Member
Members
Forum Posts: 19
Member Since:
21/09/2009
sp_UserOfflineSmall Offline

I cannot import my json data into a grid.  I get an empty grid.  I hope someone has a solution.  

The json data seems to be improperly formated.

It looks like this:

{"total":"3","page":"1","records":"71",
"rows":{
"1":{"id":"1","cell":[1," Configuration Method","Using traditional Weather Display"]},
"2":{"id":"2","cell":[2,"CSSprint","weather-print-php.css"]},
"3":{"id":"3","cell":[3,"CSSscreen","weather-screen-black-narrow.css"]}, ...
]}}}

The problem is with the {"1" after "rows": and the "n" before each new {"id": which I have highlighted in the jSon above.Cry

It should be "rows":[{"id"}

If I hand code the JSon it works.

The relevant php is:

if($page > 1)
        {
            $i = $page*30;
        }
        else
            $i = 1;
$rows = array();      
$responce['total'] = "$total_pages";
$responce['page'] = "$page";
$responce['records'] = "$count";
    
foreach ($this->wdConfig as $key=>$value)
    {
        $responce['rows'][$i]['id'] = "$i";
        $responce['rows'][$i] ['cell'] = array($i,$key,$value);
        $i++;
    }
 
$this-wdConfig is an object that has key/value configuration pairs in it.

The jSon output can be seen at:

http://billhogsett.com/wd/wd2/configToJson.php

I see a couple of possible approaches, but cannot figure either out.

1.  Get the jSon to format properly (i.e, what jQgrid expects)

2.  Configure jSonReader to handle my jSon

I will try and report back on any suggestions given to me.

Thanks.

Bill

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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