Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

JSON and NoSQL DB's

DZone's Guide to

JSON and NoSQL DB's

Free Resource

Learn how to move from MongoDB to Couchbase Server for consistent high performance in distributed environments at any scale.

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 too.so,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 .

Want to deliver a whole new level of customer experience? Learn how to make your move from MongoDB to Couchbase Server.

Topics:

Published at DZone with permission of Ramsundar Kuppusamy, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}