1. 14 Nov, 2017 1 commit
    • Emmanuele Bassi's avatar
      Add with_default() variant for JsonObject getters · 5b816ff8
      Emmanuele Bassi authored
      When using the typed getters for JsonObject, the existing API will
      automatically fail if the member requested is not present. This is
      generally good practice, because JSON data typically does not have a
      schema, and thus is has to be validated "on the go"; a JSON object
      member that contains `null`, or `0`, or `false`, is indistinguishable
      from a JSON object member that does not exist, so we cannot simply
      return a scalar value and be done with it.
      
      We can provide an escape hatch, though, for the crowd writing parsers
      for JSON data; by using Python as the model, we can add methods that
      take a default value as a parameter, and return it as a fallback value
      if the requested object member does not exist, or if it's set to `null`.
      5b816ff8
  2. 17 Jun, 2017 1 commit
  3. 18 Mar, 2017 2 commits
  4. 14 Mar, 2017 1 commit
  5. 13 Mar, 2017 1 commit
  6. 01 Mar, 2016 3 commits
  7. 06 Oct, 2015 1 commit
  8. 09 Jun, 2015 2 commits
  9. 18 Mar, 2014 2 commits
    • Emmanuele Bassi's avatar
      Reimplement JSON_VERSION_HEX as a macro call · d3095c5f
      Emmanuele Bassi authored
      Add a JSON_ENCODE_VERSION macro and use it in JSON_VERSION_HEX.
      d3095c5f
    • Emmanuele Bassi's avatar
      Use compiler annotations to determine symbol visibility · 79466474
      Emmanuele Bassi authored
      Instead of relying on a separate file that requires being update every
      time we add a new public function we should use compiler annotations to
      let the linker know which symbols are public and exported.
      
      In order to achieve this we have to:
      
       * check for the visibility=hidden attribute
       * add -fvisibility=hidden to the linker flags
       * add a macro to annotate all public symbols
      
      While we're at it, we should copy the versioned symbols macro layout
      already used by GLib, GTK+, and other G* libraries, including the
      ability to express the range of allowed versions of JSON-GLib that
      third party code can compile against.
      79466474
  10. 27 Oct, 2012 1 commit
    • Emmanuele Bassi's avatar
      node: Add typed initializers · 61553810
      Emmanuele Bassi authored
      We should simplify the JsonNode API a bit, especially when it comes to
      initializing nodes. Instead of a two-step "new(<type>) followed by a
      set_<type>(value)" API, we can provide a "init_<type>(value)" API that
      can take any existing JsonNode and initialize it to the given type.
      
      This makes the JsonNode creation more concise and reliable; it also
      allows to implicitly re-initialize JsonNodes without requiring the user
      to de-allocate/re-allocate them first.
      61553810
  11. 30 Jun, 2012 1 commit
  12. 15 Jun, 2011 1 commit
  13. 01 Jun, 2011 1 commit
  14. 06 Feb, 2011 1 commit
  15. 04 Feb, 2011 1 commit
  16. 26 Jan, 2011 1 commit
  17. 14 Dec, 2010 1 commit
    • Emmanuele Bassi's avatar
      generator: Clean up and add accessors · 9aed6f5a
      Emmanuele Bassi authored
      Instead of asking everyone to use g_object_set() to set up a
      JsonGenerator the class should provide a decent API for its properties.
      
      While we're at it, we should also use modern API for installing and
      notifying of property changes.
      9aed6f5a
  18. 12 Aug, 2010 3 commits
  19. 02 Aug, 2010 2 commits
  20. 16 Jun, 2010 1 commit
  21. 29 Nov, 2009 1 commit
  22. 23 Nov, 2009 1 commit
    • Emmanuele Bassi's avatar
      boxed: Split (de)serialization registration · 3cf919e9
      Emmanuele Bassi authored
      A GBoxed type defined as:
      
        struct Boxed {
          int foo;
          gboolean bar;
          int baz;
        };
      
      Can be represented either by a JSON object:
      
        {
          "foo" : 1,
          "bar" : true,
          "baz" : 3
        }
      
      Or by a JSON array:
      
        [ 1, true, 3 ]
      
      The current function for registering a serialization and a
      deserialization pair does not allow registering more than one
      deserialization function - which means that there can only be
      one way to deserialize a GBoxed type into a specific JsonNode
      type.
      
      To allow having more than one JsonNodeType associated to a
      GBoxed type and a deserialization function we need to split out
      the registration of the serialization and deserialization functions
      into two distinct functions.
      3cf919e9
  23. 12 Nov, 2009 1 commit
    • Emmanuele Bassi's avatar
      serializable: Add methods proxying default implementations · 63dc03da
      Emmanuele Bassi authored
      If you want to use the default implementation of serialize_property()
      and/or deserialize_property() from an object class implementing
      JsonSerializable you currently have to peek the interface vtable and
      then call the vfunc pointers.
      
      We can expose the default implementation through functions ourselves and
      simplify the required code.
      63dc03da
  24. 28 Oct, 2009 1 commit
    • Emmanuele Bassi's avatar
      gobject: Uniform JSON<->GObject mapping code · 00b4d200
      Emmanuele Bassi authored
      Rename json_gobject_new() to json_gobject_deserialize(), and
      json_gobject_dump() to json_gobject_serialize(); this maps the
      JSON GBoxed API.
      
      Also for consistency, change the serialize() return value and
      the deserialize() argument to be JsonNodes of type JSON_NODE_OBJECT.
      00b4d200
  25. 27 Oct, 2009 1 commit
  26. 28 Sep, 2009 1 commit
  27. 06 Sep, 2009 1 commit
  28. 17 May, 2009 1 commit
  29. 16 May, 2009 1 commit
  30. 17 Apr, 2009 3 commits