1. Computing & Technology

Discuss in my forum

Michael Morin

multi_json, For Juggling JSON

By , About.com GuideJune 14, 2010

Follow me on:

See More About:

JSON (JavaScript Object Notation) is a markup language for transporting objects, groups of objects or collections of arbitrary form and depth as plain text.  It's much more compact and easy to write by hand than XML, and is quickly becoming the de facto standard for this type of transport.  In Ruby, there are several options for parsing and forming JSON markup, each doing the same job in different ways.  Some developers prefer one library, some prefer another.  But they all perform the same task, so why not have an API that can work with any of them?

multi_json is just that.  If you write you Ruby programs to use multi_json to parse and form JSON strings, it will work with any of the supported JSON gems.  It will even see which gems you have installed and choose a default gem to use, so its "default" gem is one you're guaranteed to have installed.  If you prefer one gem over another, you can specify which one.  This also solves a problem of some JSON gems not being available on all platforms.  Using multi_json, you can set the default on your machines as something preferable, and others using the code will automatically use what's available to them.

While this gem is useful, it's not the only reason I'm writing about it.  Gems like this are a sign of the times.  The Ruby world is large, diverse and growing every day.  Not only are there multiple JSON gems to deal with, but multiple interpreters.  This is something that just didn't exist in the Ruby world just a few years ago, Ruby has come quite a long way in a short time.

Comments
No comments yet.  Leave a Comment
Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>
Related Searches json june 14

©2012 About.com. All rights reserved.

A part of The New York Times Company.