Hi, I'm trying to implement Json.Serializable interface. For the moment, I've just made a lazy implementation (see the attached file), which mocks default behavior of Glib.Object serialization. To test : class DummyObject : Core.JsonApi.SimpleObject { // declare properties here } int main (string[] argv) { var obj = new DummyObject (); message("%s", Json.gobject_to_data (obj, null)); return 0; } There is 2 issues : The 'list_properties' is never called (it doesn't override the base one). If I add manually the line the C generated file, in the core_json_api_simple_object_json_serializable_interface_init method : iface->list_properties = (GParamSpec* (*)(JsonSerializable*)) core_json_api_simple_object_list_properties; It works just great. String properties are handled wearily. A quick view into the glib code learns me that properties with default value are note serialized (return a null Node). But, in vala (don't know for C), string are always serialized, like if pointers was compared instead of value (maybe binding issue between vala and C, because in the glib code it is strcmp which is used for string). And with vala 0.26 (under debian), I get that (label is a string with "name" as default value) : ... ** (process:5271): DEBUG: core-json-api-simple-object.vala:54: get_property(label) => name ** (process:5271): DEBUG: core-json-api-simple-object.vala:31: serialize_property(gchararray label) => \xb0\xf7\\u0001 ... With vala 0.28 (with mingw under windows), the property is steal serialized, but in this case the result is correct. Did I miss something, or is there a binding problem with json-glib ? Thank you.
Attachment:
core-json-api-simple-object.vala
Description: Text Data