Skip to content
  • Emmanuele Bassi's avatar
    gobject: Add experimental GBoxed<->JSON transformation · ff986ee5
    Emmanuele Bassi authored
    Serializing and deserializing GBoxed types is fairly complicated
    currently. If a GObject implements JsonSerializable it is possible
    for the class to intercept the JsonNode, parse it manually and
    then set the value to the property.
    
    This leaves a hole opened for:
    
      • manual (de)serialization of GBoxed types
      • (de)serialization of GBoxed properties in classes not
        implementing JsonSerializable
    
    In order to serialize and deserialize a GBoxed JSON-GLib should
    provide a mechanism similar to the GValue transformation functions:
    when registering the boxed type the developer should also be able
    to register a serialization and a deserialization functions pair
    matching the tuple:
    
      (GBoxed type, JSON type)
    
    The serialization function would be:
    
      JsonNode *(* JsonBoxedSerializeFunc) (gconstpointer boxed);
    
    And, conversely, the deserialization function would be:
    
      gpointer (* JsonBoxedDeserializeFunc) (JsonNode *node);
    
    Obviously, the whole machinery...
    ff986ee5