<?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: from java object to json compatibility</title>
	<link>http://www.trirand.com/blog/?page_id=393/feature-request/from-java-object-to-json-compatibility</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/feature-request/from-java-object-to-json-compatibility/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>rascovich on from java object to json compatibility</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/from-java-object-to-json-compatibility#p25737</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/from-java-object-to-json-compatibility#p25737</guid>
        	        	<description><![CDATA[<p>Hi all,&#160;</p>
<p>this is not the first time I see some java to json serializer having this beahviour with List of object:</p>
<p>if there is more than one entry i&#39;ve a javascript array associated with a variable, but if the list has only one element then the variable holds directly the object (could be a json, could be a&#160;string, ....).</p>
<p>this is the output of a 2 elements list</p>
<p>{"page":"1","records":"2","rows":[{"cod_cliente":"-",...},{"cod_cliente":"-",...}],"total":"1"}</p>
<p>and this if 1</p>
<p>{"page":"1","records":"1","rows":{"cod_cliente":"-",...},"total":"1"}</p>
</p>
<p>rows.... to be or not to be an array...</p>
<p>also if is not a jqGrid&#39;s problem it doesnt&#39;work!</p>
</p>
<p>i simply suggest this little patch to be more solid</p>
<p>in the addJSONData function just after the&#160;line</p>
<p>if (!drows) { drows = []; }</p>
<p>add</p>
<p>if (ts.p.records == 1) {</p>
<p><span style="white-space: pre;"> </span>if (! drows.length) {</p>
<p><span style="white-space: pre;"> </span>var no_array_row = drows;</p>
<p><span style="white-space: pre;"> </span>drows = new Array(1);</p>
<p><span style="white-space: pre;"> </span>drows[0] = no_array_row;</p>
<p><span style="white-space: pre;"> </span>}</p>
<p>}</p>
]]></description>
        	        	<pubDate>Fri, 20 Jan 2012 13:51:01 +0200</pubDate>
        </item>
</channel>
</rss>