Re: save my JSON
- --- In email@example.com, Mark Ireland <markincuba@...> wrote:
> Is storing a JSON string in a database:Hi Mark,
> A: a crap idea. period.
> B: a crap idea under most common circumstances
> C: pure genius
> Thanks. You've been helpful.
In a major project I'm currently involved in we had to consider how
to store client side data and process it server side. JSON was one of
the first suggestions. However, the database team (MS SQL 2005) did
not like it one bit, because they could not do queries or perform any
other programatic access to it "easily". Of course we all know that
is not true but remember that JSON is more or less the scariest thing
around to anyone other than us web folks.
We ended up with a good alternate solution. All client side JSON is
transformed to XML before storing it in the database. Now the db-team
were able to use XPath/XQuery to drill the data, and they were quite
happy. When the data is retrieved it is transformed back into the
original JSON structure, leaving the web guys quite happy. Happy
faces all around - done deal!
xml-and-xml-to-json/ for the implementation we use for the JSON<->XML
Hinnerup Net ApS
Mob: (+45) 29 72 55 34
- On Mon, Apr 14, 2008 at 11:41 PM, Michael Schøler <michael@...> wrote:
>Fundamentally there are 2 very distinct major classes of use cases:
> --- In firstname.lastname@example.org, Mark Ireland <markincuba@...> wrote:
> > Is storing a JSON string in a database:
> > A: a crap idea. period.
> > B: a crap idea under most common circumstances
> > C: pure genius
> > Thanks. You've been helpful.
> Hi Mark,
> In a major project I'm currently involved in we had to consider how
> to store client side data and process it server side. JSON was one of
> the first suggestions. However, the database team (MS SQL 2005) did
> not like it one bit, because they could not do queries or perform any
> other programatic access to it "easily". Of course we all know that
> is not true but remember that JSON is more or less the scariest thing
> around to anyone other than us web folks.
those where data is mostly or completely access as a single entity
(one row, xml/json blob), and those where one need to deal with sets.
While RDBMSs aren't even optimal for the first use case, they are
often used for them too.
DBAs frown upon "store xml as BLOB" approach, yet that's generally the
most sensible way to do it: it's much much more flexible, doesn't need
complicated slice 'n dice logics to fit possibly complicated
structured data into simple relational model ("square peg through
round hole"), and inevitable structural changes do not result in
schema changes. For second case RDBMSs make sense, and it's more of a
question of how to bind data; json can at most be used as interchange
formats between data tier and processing (task which it can do better
than xml although both work ok).
In the second case, where queryability is needed, native xml databases
or object DBs would often be more optimal choices, but sometimes one
just has to work with whatever exists. And chances are that
corporations just have Oracle instances, independent of whether they
are good choice for various storage needs or not.
Personally, more often than not I like yet another combination:
storing json or xml docs in Amazon S3. But this is due to our use
cases (storing configuration data in versionable sets) and YMMV.
Anyway, one final note: the biggest thing IMO that is still mising
from json world are data binding tools: for Java, equivalents of JAXB
and Hibernate (binding between json and objects/relational model,
Once those exist, interoperability will be much easier to deal with
for most common cases.
-+ Tatu +-
- --- In email@example.com, "kriszyp" <kriszyp@...> wrote:
> ...I've just read a nice article regarding RESTful web services I would
> If you are interested in storing JSON data in a database, you should
> take a look at my project, Persevere
> (http://code.google.com/p/persevere-framework/). It works with a
> RESTful JSON interface.
like to share:
RESTful Web Services vs. ``Big'' Web Services: Making the Right