Re: JSON generation in C/C++

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 1, 2011 at 11:04, Colin Patrick McCabe
<colin.mccabe@xxxxxxxxxxxxx> wrote:
> One thing that neither Jansson nor JSON-C offer, to my knowledge, is
> the ability to do SAX-style parsing of a JSON document. In other
> words, to set up a bunch of function pointers and have them called at
> various points during parsing. I did not personally feel the need for
> this, since my JSON data was small enough that memory consumption was
> a non-issue, but I guess someone else might. If Jansson wants to do
> something to differentiate itself from the competition, that could be
> it.

As far as my experience with various JSON encoders/decoders goes,
that's the typical case. Most libraries cater for the simple case of
being able to hold the full object in memory, and if that is not
possible, it's more typical to go for an approach where the input is a
stream of objects, one per line (e.g. Twitter streaming and all kinds
of mapreduce solutions do this).

Jansson's differentiating factor is that it's significantly simpler
than json-c. My buddies use it for embedded development.

> I am not sure how I feel about using libraries to output (as opposed
> to parse) JSON. There is a point where a task becomes simple enough
> that using more libraries is an anti-pattern. For example, would you
> use a library to output CSV? Probably not. The only thing you have to
> remember is to properly do escaping.

I would. The doublequote rules of CSV are a pain to get right, and I
don't want to keep rewriting unit tests for that particular wheel.
Ceph has already had multiple bugs of this kind.
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux