<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: JSON Parsing in android</title>
	<atom:link href="http://www.androidcompetencycenter.com/2009/10/json-parsing-in-android/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.androidcompetencycenter.com/2009/10/json-parsing-in-android/</link>
	<description>Tutorials, Tips and tricks, Tools for Android development</description>
	<lastBuildDate>Mon, 06 Sep 2010 06:39:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Cowtowncoder</title>
		<link>http://www.androidcompetencycenter.com/2009/10/json-parsing-in-android/comment-page-1/#comment-489</link>
		<dc:creator>Cowtowncoder</dc:creator>
		<pubDate>Sat, 04 Sep 2010 04:49:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=462#comment-489</guid>
		<description>I am not sure it really makes sense to use the default JSON parser (one from json.org) -- it is very clumsy, inefficient and lots of code to write. Rather, packages like Gson and Jackson make JSON handling much much more convenient. So while tutorials are good, I really wish they actually tried to show best practices and not just arbitrary ways.</description>
		<content:encoded><![CDATA[<p>I am not sure it really makes sense to use the default JSON parser (one from json.org) &#8212; it is very clumsy, inefficient and lots of code to write. Rather, packages like Gson and Jackson make JSON handling much much more convenient. So while tutorials are good, I really wish they actually tried to show best practices and not just arbitrary ways.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Dawson</title>
		<link>http://www.androidcompetencycenter.com/2009/10/json-parsing-in-android/comment-page-1/#comment-467</link>
		<dc:creator>Chris Dawson</dc:creator>
		<pubDate>Mon, 26 Jul 2010 17:31:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=462#comment-467</guid>
		<description>Doh, actually the second line should be:

String theError = jObject.getString(&quot;error&quot;);</description>
		<content:encoded><![CDATA[<p>Doh, actually the second line should be:</p>
<p>String theError = jObject.getString(&#8220;error&#8221;);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Dawson</title>
		<link>http://www.androidcompetencycenter.com/2009/10/json-parsing-in-android/comment-page-1/#comment-466</link>
		<dc:creator>Chris Dawson</dc:creator>
		<pubDate>Mon, 26 Jul 2010 17:29:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=462#comment-466</guid>
		<description>&lt;a href=&quot;#comment-432&quot; rel=&quot;nofollow&quot;&gt;@Pedro Teixeira&lt;/a&gt; 
Pedro, hopefully you figured this out, but the testing variable you are passing into JSONArray is not an array but a hash (or associative array).  If you were to use [&#039;error&#039;, &#039;empty&#039;] then it would parse, but I don&#039;t think that is what you want to do.  If I understand your intention correctly, you want to retrieve the &quot;empty&quot; value from this hash by specifying the key &quot;error&quot;.  To do this, use this code:

jObject = new JSONObject(testing);
String theError = (String)jObject.getJSONObject(&quot;error&quot;);

Now, theError should have the correct value of &quot;empty&quot;.</description>
		<content:encoded><![CDATA[<p><a href="#comment-432" rel="nofollow">@Pedro Teixeira</a><br />
Pedro, hopefully you figured this out, but the testing variable you are passing into JSONArray is not an array but a hash (or associative array).  If you were to use ['error', 'empty'] then it would parse, but I don&#8217;t think that is what you want to do.  If I understand your intention correctly, you want to retrieve the &#8220;empty&#8221; value from this hash by specifying the key &#8220;error&#8221;.  To do this, use this code:</p>
<p>jObject = new JSONObject(testing);<br />
String theError = (String)jObject.getJSONObject(&#8220;error&#8221;);</p>
<p>Now, theError should have the correct value of &#8220;empty&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew</title>
		<link>http://www.androidcompetencycenter.com/2009/10/json-parsing-in-android/comment-page-1/#comment-458</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Tue, 20 Jul 2010 19:53:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=462#comment-458</guid>
		<description>I wrote up a very extensive tutorial on using JSON in Android (that also deals with best practices for downloading files using Android) that I think would be very, very helpful to anyone using this page.  You can find it here:
http://blog.andrewpearson.org/2010/07/android-why-to-use-json-and-how-to-use.html</description>
		<content:encoded><![CDATA[<p>I wrote up a very extensive tutorial on using JSON in Android (that also deals with best practices for downloading files using Android) that I think would be very, very helpful to anyone using this page.  You can find it here:<br />
<a href="http://blog.andrewpearson.org/2010/07/android-why-to-use-json-and-how-to-use.html" rel="nofollow">http://blog.andrewpearson.org/2010/07/android-why-to-use-json-and-how-to-use.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pedro Teixeira</title>
		<link>http://www.androidcompetencycenter.com/2009/10/json-parsing-in-android/comment-page-1/#comment-432</link>
		<dc:creator>Pedro Teixeira</dc:creator>
		<pubDate>Thu, 17 Jun 2010 18:39:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=462#comment-432</guid>
		<description>Hello,

I have this JSON String: 

testing = {&quot;error&quot;:&quot;empty&quot;}

It&#039;s on a correct format right? 

When I try to put it on an JSON Array

CODE: SELECT ALL
info = new JSONArray(testing);


I always get this JSON Exception: 
CODE: SELECT ALL
org.json.JSONException: A JSONArray text must start with &#039;[&#039; at character 1 of {&quot;error&quot;:&quot;empty&quot;}


I mean.. the String is already in the JSON String format so I really don&#039;t understand what&#039;s going on. I tried to append the &#039;&#039;[]&#039;&#039; it doesn&#039;t give me the exception anymore, but I&#039;m also not able to retrieve the values I want in this case info.getString(0) which would give me the &#039;&#039;error&#039;&#039;.

Does anyone have any ideia what I&#039;m doing wrong? I&#039;ve been through JSON parsing tutorials, and I&#039;m doing like they say...</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>I have this JSON String: </p>
<p>testing = {&#8220;error&#8221;:&#8221;empty&#8221;}</p>
<p>It&#8217;s on a correct format right? </p>
<p>When I try to put it on an JSON Array</p>
<p>CODE: SELECT ALL<br />
info = new JSONArray(testing);</p>
<p>I always get this JSON Exception:<br />
CODE: SELECT ALL<br />
org.json.JSONException: A JSONArray text must start with &#8216;[' at character 1 of {"error":"empty"}</p>
<p>I mean.. the String is already in the JSON String format so I really don't understand what's going on. I tried to append the ''[]&#8221; it doesn&#8217;t give me the exception anymore, but I&#8217;m also not able to retrieve the values I want in this case info.getString(0) which would give me the &#8221;error&#8221;.</p>
<p>Does anyone have any ideia what I&#8217;m doing wrong? I&#8217;ve been through JSON parsing tutorials, and I&#8217;m doing like they say&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hany</title>
		<link>http://www.androidcompetencycenter.com/2009/10/json-parsing-in-android/comment-page-1/#comment-400</link>
		<dc:creator>hany</dc:creator>
		<pubDate>Sat, 24 Apr 2010 10:18:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=462#comment-400</guid>
		<description>Thanks , this tutorial helped me a lot.</description>
		<content:encoded><![CDATA[<p>Thanks , this tutorial helped me a lot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephan Celis</title>
		<link>http://www.androidcompetencycenter.com/2009/10/json-parsing-in-android/comment-page-1/#comment-395</link>
		<dc:creator>Stephan Celis</dc:creator>
		<pubDate>Tue, 20 Apr 2010 07:36:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=462#comment-395</guid>
		<description>Thanks this tutorial helped me a lot. Great share.</description>
		<content:encoded><![CDATA[<p>Thanks this tutorial helped me a lot. Great share.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shyam</title>
		<link>http://www.androidcompetencycenter.com/2009/10/json-parsing-in-android/comment-page-1/#comment-393</link>
		<dc:creator>Shyam</dc:creator>
		<pubDate>Tue, 13 Apr 2010 10:00:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=462#comment-393</guid>
		<description>&lt;a href=&quot;#comment-389&quot; rel=&quot;nofollow&quot;&gt;@Michel&lt;/a&gt; 
thanks Michel</description>
		<content:encoded><![CDATA[<p><a href="#comment-389" rel="nofollow">@Michel</a><br />
thanks Michel</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michel</title>
		<link>http://www.androidcompetencycenter.com/2009/10/json-parsing-in-android/comment-page-1/#comment-389</link>
		<dc:creator>Michel</dc:creator>
		<pubDate>Wed, 31 Mar 2010 10:02:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.androidcompetencycenter.com/?p=462#comment-389</guid>
		<description>Great!

very good example</description>
		<content:encoded><![CDATA[<p>Great!</p>
<p>very good example</p>
]]></content:encoded>
	</item>
</channel>
</rss>
