NoSQL Zone is brought to you in partnership with:

Senior Software Engineer at Parexel International .Experienced in middle tier development using JEE technologies.I get easily influenced by the buzz words in java ecosystem and likes to experiment with them.Apart from job,loves skiing,biking and other outdoor activities. Ramsundar is a DZone MVB and is not an employee of DZone and has posted 5 posts at DZone. View Full User Profile


  • submit to reddit
Last few months my work involved some web services stuffv(SOAP). For a variety of reasons,SOAP was chosen over REST,which means i had to deal again with XML's. There are plenty of libraries and tools in market to parse or build a XML,but still never in my life i felt comfortable with xml parsers.

Heard a lot about json and wanted to give it a try some time.In my current work,there was a scenario,where i had to persist the state of object and reuse it at a later point of time.

Yeah, immediate thing that came to my mind was xml, but then the complexity of using a binding framework like jaxb, castor, etc. with their annotations, xml mapping file, blah blah... looked like complicating the whole stuff.  My first try at json was like a breeze.
All I had to do was add a json library (I used google gson).  The syntax looked like,

gson.toJson(object) gson.fromJson(string)

That's it.  You just converted your string to json format and vice versa.  As simple as it gets.more readable and it took only half the space to store the same data in the db. So.. definitely JSON looks more simpler and efficient.recently ,many would have come across the buzzword "nosql" db.intial thoughts were,its not for enterprise applications. but the concept of non-relational database makes more sense now.

Let's assume I had to save a simple registration form.the user inputs name,age and sex.  A typical RDBMS in this scenario will have a table with 3 columns for name,age and sex and maybe one sequence generated ID column.sometime later,there is a new requirement to store address as well. Yes, one ends up modifying the schema and face all the hassles related to data migration process.

What if we used a nosql db which stores data in key/value pair?  Lets say key is some unique id and value is the complete registration form.  Nosql db allows you to store the complete document as value to the given key.and they have seems to have a nice query language,which means your db is naturally scalable and its very much possible that you retrieve the data in json format and directly pass to the javascript in UI(in many scenarios).  Current javascript libraries like jquery, protoype, etc. are getting better and better every day.

And there seems to be many big players in the nosql league like hbase,mongodb,couchdb,cassandra,etc. They are getting more attention as facebook, twitter, etc. recently switched to such schema free database.  Maybe its the end of RDBMS and XML world .
Published at DZone with permission of Ramsundar Kuppusamy, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Patrick Talbot replied on Fri, 2010/05/21 - 8:00am

Actually if all you need is serialize/deserialize, it can be easy in XML too. Try XStream, no parsing involved!

Alessandro Santini replied on Fri, 2010/05/21 - 8:05am

  1. XML is not going to die anytime soon - webservices using XML will, probably.
  2. JSON is not going to replace XML.
  3. Before NoSQL can have the same adoption of RDBMS, you and me will be ash.

Jonathan Fullam replied on Fri, 2010/05/21 - 8:27am

NoSql databases have already proven to be very useful. Large and very successful social networking sites rely heavily on the technology. Leading cloud service providers such as Amazon are providing such technology as part of their offerings.

I agree with Ramsundar completely that storing data as JSON in a NoSql database for use by javascript based clients is very attractive. JSON is very natural to JavaScript (it is javascript!) and the overhead of a RDBMS is sometimes unnecessary when creating web applications. The emergence of javascript libraries and frameworks that compile other languages to javascript (like Google Web Toolkit for Java and Pyjamas for Python) for building rich internet applications further supports this architecture.

Eliseo Soto replied on Fri, 2010/05/21 - 10:01am

I use Jackson and so far I'm very happy with it. It's the "official" JSON parser used by Spring. Also I have a wrapper class that only has the fromJson(String, Class) and toJson(Object) methods, that way I can add a layer of abstraction if I decide to use some other library in the future.

Sumit Pal replied on Sat, 2010/05/22 - 5:58am

CouchDB a NoSQL like - Document Oriented DBs uses JSON and REST based APIs to interact with the DB. It also supports defining Map Reduce functions using Javascript

Michael Parmeley replied on Mon, 2010/05/24 - 2:14pm

JAXB doesn't require annotations. It is just as easy to serialize/deserialize XML with JAXB as you showed with JSON.

 If you want to control how the XML looks with JAXB then you can use annotations. Most objects serialized with JAXB do eventually get annotations added to them but it certainly isn't required.

 Also, XStream doesn't require annotations either. Just like JAXB you can add annotations to control what the XML looks like, but isn't required.

Avi Yehuda replied on Wed, 2010/05/26 - 5:50am

Hi Ramsundar,

It is true that NoSQLs have a lot of advantages over RDBMS but I wouldn’t say goodbye to  RDBM&SQL quite yet.

Bear in mind, that in most of the cases, mature applications change their schema almost never.
Sometimes it is more important for an application to be able to insert data fast and synchronically.
In these cases NoSQL is not as good as old time DBs.

Besides, if consistency is important to you NoSQL data stores are totally wrong for you. I mean, can you imagine a bank application which is working inconsistently with data?!

But still, I like NoSQL, I think there here to stay.

Liezel Jane Jandayan replied on Thu, 2011/08/11 - 5:43am

Next genereation database addresses some pints of being rational, opensource and horizontally scalable. The original intention has been modified as modern web scale databases.

Senior Healthcare Consultants

Michael Eric replied on Wed, 2012/09/26 - 4:00pm

No, it is not that easy... It is a long way to go.. may be another couple of decads before NoSQL got the kind of acceptance RDBMS enjoys!!
By the way XML will not die down so soon.. still will be with webservices...


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.