<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
	<title>jQuery Grid Plugin - jqGrid - Topic: jSon Badly Formatted--Help Please</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/json-badly-formatted-help-please</link>
	<description><![CDATA[Grid plugin]]></description>
	<generator>Simple:Press Version 5.7.5.3</generator>
	<atom:link href="http://www.trirand.com/blog/?page_id=393/help/json-badly-formatted-help-please/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>bhogsett on jSon Badly Formatted--Help Please</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/json-badly-formatted-help-please#p22323</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/json-badly-formatted-help-please#p22323</guid>
        	        	<description><![CDATA[<p>I cannot import my json data into a grid.&#160; I get an empty grid.&#160; I hope someone has a solution. &#160;</p>
<p>The json data seems to be improperly formated.</p>
<p>It looks like this:</p>
<p>{"total":"3","page":"1","records":"71",<br /><strong>"rows":{</strong><br /><strong>"1":</strong>{"id":"1","cell":[1," Configuration Method","Using traditional Weather Display"]},<br /><strong>"2":</strong>{"id":"2","cell":[2,"CSSprint","weather-print-php.css"]},<br /><strong>"3":</strong>{"id":"3","cell":[3,"CSSscreen","weather-screen-black-narrow.css"]}, ...<br />]}}}</p>
<p>The problem is with the {"1" after "rows": and the "n" before each new {"id": which I have highlighted in the jSon above.<img class="spSmiley" style="margin:0" title="Cry" src="/blog/wp-content/forum-smileys/sf-cry.gif" alt="Cry" /></p>
<p>It should be "rows":[{"id"}</p>
<p>If I hand code the JSon it works.</p>
<p>The relevant php is:</p>
<p>if($page &#62; 1)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $i = $page*30;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; else <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $i = 1;<br />$rows = array(); &#160;&#160;&#160; &#160;<br />$responce[&#39;total&#39;] = "$total_pages"; <br />$responce[&#39;page&#39;] = "$page"; <br />$responce[&#39;records&#39;] = "$count"; <br />&#160;&#160; &#160;<br />foreach ($this-&#62;wdConfig as $key=&#62;$value) <br />&#160;&#160;&#160; { <br />&#160;&#160; &#160;&#160;&#160; &#160;$responce[&#39;rows&#39;][$i][&#39;id&#39;] = "$i";<br />&#160;&#160; &#160;&#160;&#160; &#160;$responce[&#39;rows&#39;][$i] [&#39;cell&#39;] = array($i,$key,$value);<br />&#160;&#160; &#160;&#160;&#160; &#160;$i++;<br />&#160;&#160; &#160;} <br />&#160;<br />$this-wdConfig is an object that has key/value configuration pairs in it.</p>
<p>The jSon output can be seen at:</p>
<p><a href="http://billhogsett.com/wd/wd2/configToJson.php" rel="nofollow" target="_blank">http://billhogsett.com/wd/wd2/configToJson.php</a></p>
<p>I see a couple of possible approaches, but cannot figure either out.</p>
<p>1.&#160; Get the jSon to format properly (i.e, what jQgrid expects)</p>
<p>2.&#160; Configure jSonReader to handle my jSon</p>
<p>I will try and report back on any suggestions given to me.</p>
<p>Thanks.</p>
<p>Bill</p>
]]></description>
        	        	<pubDate>Sat, 05 Mar 2011 18:52:54 +0200</pubDate>
        </item>
</channel>
</rss>