GData Api and JSON feed generation from java

I found that google GData API allow you to access and manage almost all google-services (like Calendar, Picassa, Blogger). It give you numerous ways to do that – via java, PHP, javascript or pure HTTP/XML feeds. very powerful. great work!
And on the moment there are a lot of components exists which use that API.

But components I need require JSON feed which could be generated by HTTP request to google Calendar-Service, but the problem is I don’t want to put my data here to access it, I just need to generate JSON from my events.
Unfortunately I don’t find the solution in java-gdata API for that, what I find was only the small notice in documentation

The XmlWriter class exposes a number of protected methods that enable it to be subclassed for the purposes of customizing its output. See {@link} for an example.

Hey, they have the solution for my problem! But in reality there is no such class (I will be very helpful for somebody who can point me to the source/jar with that file) But it seems it only the notice in documentaiton which express one of the the design point for that class.

Ok, it’s not great, but I want that JSON to be generated and I wrote my own implementation of JsonWriter which use org.json implementation. It was not easy since I don’t find anything except that draft comparison of XML and JSON formats.
So actually I based on the generateAtom() method of BaseFeed and write JsonWriter implementation which was tested by using it with google gdata javascript api, which successfully transform it to the CalendarEventFeed/CalendarEvent objects.

I will update it later with sources and comments. Implementation is in really draft (but working) state.
The open question for me is how that changes could be promoted to a google-community/google data-api research group.


Tagged with: , , , , ,
Posted in Software Development

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: