SilverHoodCorp / gdata-java-client

Automatically exported from code.google.com/p/gdata-java-client
Apache License 2.0
0 stars 0 forks source link

Support for JSON #207

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Would you be able to add JSON support for the feed that is returned?
Currently GData-java-client only seems to support atom.

GData seems to be facing issues with the resin server's parser while
parsing the atom feed. I can fix this by specifying SAXParser as the
default parser for resin, but I do not want to do that since the default
resin parser is supposedly faster.

Original issue reported on code.google.com by nischals...@gmail.com on 12 Nov 2009 at 9:48

GoogleCodeExporter commented 9 years ago
You can get a JSON formatted output by doing a GET request with "alt=json" query
parameter.

http://code.google.com/apis/gdata/docs/2.0/reference.html#Queries

Original comment by vbarat...@gmail.com on 12 Nov 2009 at 12:35

GoogleCodeExporter commented 9 years ago
I know about the "alt" param. When I do that, I get "invalid content type" 
error.
GData-java-client currently doesn't support json. It only supports atom. I hope
you're getting what I intend to convey?

Original comment by nischals...@gmail.com on 12 Nov 2009 at 2:52

GoogleCodeExporter commented 9 years ago
I've attached the screenshot from the article which specifies the same.
http://code.google.com/apis/gdata/docs/json.html

Original comment by nischals...@gmail.com on 12 Nov 2009 at 2:57

Attachments:

GoogleCodeExporter commented 9 years ago
I see.  If it is read-only operation you can use json output with custom 
client-code
using a JSONObject representation to walk through the values.  Technically you 
can
use the java core client library to get the auth token, and make your own http
requests to retrieve the json feed and parse it into your data structure 
(JSONObject
or your implementation).  IMO the genesis JSON parsing does not belong in the 
client
library, as this is more likely intended for js clients.

For read-write you cannot post back JSON.  So for post/put operation you need 
to use xml.

Original comment by vbarat...@gmail.com on 13 Nov 2009 at 5:41

GoogleCodeExporter commented 9 years ago
Thanks for the suggestion. I did not want to reinvent the wheel by requesting 
and
parsing since the gdata java api does an excellent job.

I've resolved this problem by instantiating the xerces parser implementation
explicitly in XmlParser.java class. That way, the parser implementation isn't 
decided
by resin server :)

Original comment by nischals...@gmail.com on 13 Nov 2009 at 5:51