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
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,
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 too.so,which means your db is naturally scalable and its
very much possible that you retrieve the data in json format 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 .