Let me mention another lightweight data-interchange format.
At http://www.janestreet.com we have developed a small c module to deal
with S-expressions (sexp) as a way to store arbitrary data. As we write
most of our code in OCaml sexps are a natural way for us to store data.
http://hg.ocaml.info/release/sexplib/ provides automatic ways to convert
"any" ocaml value into a sexp).
The extension is still pretty new but we use it successfully on a daily
basis. After we have upgraded to 9.x we will pack it as an extension
and releast it opensource.
API wise the module at the moment offers the following:
sexp_validate(text) returns boolean
Validate that the passed in text is a valid s expression.
create domain sexp as text check (sexp_validate(value));
BTW: It is a PITA that arrays of domains are not valid types.
And several functions to manipulate take apart sexp's or modify sexp's
using a path into the sexp (similar to what xpath does for xml).
Such as:
sexp_get(sexp, text) returns sexp
Get the sub sexp of sexp identified by the path.
Returns NULL if path is not a valid path in sexp.
Example:
path=.a space.b.[1].x
((ignore this) ("a space" ((b (0 ((also ignored) (x "The Value")) )) )))
-> "The Value"
And sexp_get_atom(sexp, text) returns text
Get the sub atom of sexp identified by the path.
Returns NULL if path is not a valid path in sexp or
does not identify an atom.
Example:
path=.a space.b.[1].x
((ignore this) ("a space" ((b (0 ((also ignored) (x "The Value")) )) )))
^^^^^^^^^
-> The Value
Cheers,
Bene
On 20/12/11 19:39, Claes Jakobsson wrote:
> On Dec 20, 2011, at 12:39 AM, David E. Wheeler wrote:
> > On Dec 19, 2011, at 2:49 AM, Dimitri Fontaine wrote:
> >
> >> My understanding is that JSON is a subset of ECMAscript
> >
> > Well, no, JSON is formally “a lightweight data-interchange format.” It’s
> > derived from JavaScript syntax, but it is not a programming language, so I
> > wouldn’t say it was accurate to describe it as a subset of JS or ECMAScript.
> >
> > http://json.org/
>
> Are people explicitly asking for a) *JSON* datatype or b) a type that lets
> you store arbitrary complex semi-untyped data structures?
>
> if b) then this might get a lot more interesting
>
> Cheers,
> Claes
> --
> Sent via pgsql-hackers mailing list ([email protected])
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers