Re: Storage API



hi Colin;

On 1 May 2013 09:31, Colin Walters <walters verbum org> wrote:
On Wed, 2013-05-01 at 16:31 +0200, Bastien Nocera wrote:
 Dumping
serialised Javascript objects to the filesystem isn't really elegant
either.

It isn't, but for what it's worth that's what I do currently:
https://git.gnome.org/browse/gnome-ostree/tree/src/js/jsonutil.js

also, if you have GObjects you want to serialize to JSON, you can use
JSON-GLib's serialization:

  https://developer.gnome.org/json-glib/0.16/json-glib-GObject-Serialization.html#json-gobject-serialize

and then use JsonGenerator to push to a GOutputStream:

  https://developer.gnome.org/json-glib/0.16/JsonGenerator.html#json-generator-to-stream

the deserialization step uses JsonParser and
json_gobject_deserialize(). we also have GVariant <-> JSON.

ciao,
 Emmanuele.

--
W: http://www.emmanuelebassi.name
B: http://blogs.gnome.org/ebassi/


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