| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Fixes #67
|
|
|
|
| |
Avoid compiler warnings when running with `-Wunused-parameter`.
|
| |
|
|\
| |
| |
| |
| | |
Use gi-docgen to build the API reference
See merge request GNOME/json-glib!41
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Drop `SECTION` blurbs.
Use gi-docgen syntax for internal links.
Use summary lines for gi-docgen indices.
Use Markdown syntax for code fragments.
|
|/ |
|
|
|
|
|
|
| |
Don't pretty print newlines. This requires a change in the generator
test, but the pretty printing format is not stable anyway, so we can get
away with it.
|
|
|
|
|
|
| |
This allows callers to avoid extra allocations
when dumping to a preexisting string.
https://bugzilla.gnome.org/show_bug.cgi?id=773504
|
|
|
|
|
|
|
| |
Use JsonObject's private members_ordered
GQueue instead. This avoids a g_list_copy().
https://bugzilla.gnome.org/show_bug.cgi?id=773504
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
methods
json_builder_add_boolean_value
json_builder_add_double_value
json_builder_add_int_value
json_builder_add_null_value
json_builder_add_string_value
json_builder_add_value
json_builder_begin_array
json_builder_begin_object
json_builder_end_array
json_builder_end_object
json_builder_get_root
json_builder_set_member_name
json_generator_get_root
json_reader_get_error
json_reader_get_member_name
json_reader_get_value
json_serializable_find_property
json_serializable_find_property
json_boxed_serialize
|
|
|
|
|
|
|
| |
Instead share a single GString in all
dump functions.
https://bugzilla.gnome.org/show_bug.cgi?id=773504
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When converting json to its string representation, whole-doubles (such
as 1.0) would be converted into strings without decimals ("1"). That can
be inconvenient e.g. when converting from/to GVariants.
To avoid this, append '.0' to the string representation for doubles if
they lost their decimals in the conversion.
Also add / update unit tests for this.
https://bugzilla.gnome.org/show_bug.cgi?id=753763
|
|
|
|
| |
https://bugzilla.gnome.org/show_bug.cgi?id=773603
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add reference counting semantics to JsonNode, in addition to the
existing init/unset and alloc/free semantics.
json_node_free() must only be used with nodes allocated using
json_node_alloc(). json_node_unref() may be used with all nodes (if
correctly paired; it may be paired with json_node_alloc()).
It is not valid to call json_node_free() on a node whose reference count
is not 1.
https://bugzilla.gnome.org/show_bug.cgi?id=756121
|
|
|
|
|
|
|
| |
Escaping these as octals is out of the JSON spec completely,
so roll our own string encoder.
https://bugzilla.gnome.org/show_bug.cgi?id=730425
|
|
|
|
|
|
| |
Also fix empty keys, which are now encoded properly.
https://bugzilla.gnome.org/show_bug.cgi?id=727593
|
|
|
|
| |
All the platforms and build system we support have a config.h header.
|
|
|
|
|
| |
Drop the DocBook documentation, and move everything to the MarkDown
format used by modern gtk-doc.
|
|
|
|
| |
We can use the autogenerated get_instance_private() function.
|
|
|
|
|
| |
We depend on a new version of GLib, so we can remove a bunch of old
version checks.
|
|
|
|
|
|
|
|
| |
If we're being compiled against a newer version of GLib, we should use
the new macros that add instance private data.
Since this is a stable branch, we cannot bump the GLib requirement; so
we use version checks to conditionally compile the new code.
|
|
|
|
|
| |
We don't need to turn a JsonValue into a GValue, given that we only care
about the JSON types when serializing to JSON.
|
|
|
|
| |
https://bugzilla.gnome.org/show_bug.cgi?id=640729
|
|
|
|
|
|
|
| |
The nice format escape for g_ascii_formatd() is not really suited for a
serialization format, as it obviously loses precision.
https://bugzilla.gnome.org/show_bug.cgi?id=637244
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
JsonGenerator is not able to generate strings for bare values, something
that completely went under the radar for all this time.
|
|
|
|
|
|
|
| |
Currently, only synchronous API.
The output handling is pretty trivial, unlike the input handling in
JsonParser; this is a really basic convenience API.
|
|
|
|
|
|
|
|
|
|
|
| |
I should read the documentation for the functions I use:
Converts a gdouble to a string, using the '.' as decimal point. To
format the number you pass in a printf()-style format string. Allowed
conversion specifiers are 'e', 'E', 'f', 'F', 'g' and 'G'.
-- from g_ascii_formatd() in GLib's API reference
Epic reading fail.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Under some locales (e.g. de_DE) a double is converted to a string
containing a comma instead of a dot. That breaks the JSON syntax.
Example:
Double: 0.34 is converted to 0,34 when using locale de_DE
http://bugzilla.openedhand.com/show_bug.cgi?id=1826
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
|
|
|
|
| |
Clean up some notes, and add introspection annotations where needed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The JSON RFC does not specify the size of the integer type, thus
implicitly falling back to machine-size.
This would all be fine and dandy if some demented Web Developer (and
I use the term "developer" *very much* loosely) did not decide to
use integers to store unique identifiers for objects; obviously, you
can't have more than 2^32-1 status messages in a database with
millions of users who update their status multiple times per day.
Right, Twitter?
Anyway, some languages do a type auto-promotion from Integer to
Long, thus pushing the limit of allowed positive values -- until the
next integer overflow, that is. C, and GLib, do not do that
transparently for us so we need to:
- always use gint64 when parsing a JSON data stream using
JsonScanner
- move all the Node, Object and Array APIs to gint64
- auto-promote G_TYPE_INT to G_TYPE_INT64 when setting
a GValue manually
- auto-promote and auto-demote G_TYPE_INT properties when
(de)serializing GObjects.
The GLib types used internally by JSON-GLib are, thus:
integer -> G_TYPE_INT64
boolean -> G_TYPE_BOOLEAN
float -> G_TYPE_DOUBLE
string -> G_TYPE_STRING
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of allocating the escape table to be used with g_strescape()
for each string we can have it unrolled already in code.
Thanks to: Christian Persch <chpe@gnome.org>
Fixes bug:
http://bugzilla.openedhand.com/show_bug.cgi?id=1648
|
|
|
|
|
|
|
|
| |
THere is no such thing as the "Lesser General Public License
version 2": the LGPL v2 is the "Library GPL", and has been
superceded by v2.1 with the new "Lesser GPL" name.
Also, the copyright is now Intel Corp.
|
|
|
|
|
|
|
|
|
|
| |
The JsonNode structure has always been meant to be completely
opaque; we indirectly exposed the :type member, but only for
access through the JSON_NODE_TYPE() macro.
Since that macro has become a proxy for the json_node_get_node_type()
function we can safely move everything into a private, uninstalled
header file and let JsonNode be completely opaque to the developer.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
When using json-glib to write a blog system, some deserialized objects
were not been interpreted by javascript because there were line breaks
in generated strings.
Patch from Lincoln de Sousa.
Bug #958 - JsonGenerator does not escape special characters
Signed-off-by: Emmanuele Bassi <ebassi@openedhand.com>
|
|
|
|
|
| |
Including the autotools generated config.h should always be conditional
on the HAVE_CONFIG_H definitions.
|
|
|
|
| |
Found this very dumb leak while using Valgrind.
|
|
|
|
|
| |
The indent character should be any Unicode character available instead
of a generic char.
|
|
|
|
|
| |
The JsonGenerator:indent-char can be used to control the character that
indents the lines when pretty printing.
|
|
|
|
|
| |
JsonNode of type value for floating point numbers is G_TYPE_DOUBLE
and not G_TYPE_FLOAT anymore.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
JsonGenerator now has a :root property, so it can be constructed using
just g_object_new():
generator = g_object_new (JSON_TYPE_GENERATOR,
"pretty", TRUE,
"indent", 4,
"root", node,
NULL);
This means that the root node is copied inside the generator, instead of
just taking ownership (it was quite confusing). The documentation now
clearly states what happens, and that you can safely free the node after
feeding it to the JsonGenerator.
|
|
|
|
|
| |
This is what happens when you fix a compiler warning about a shadowing
variable and you don't run the test suite to check the results.
|
| |
|
|
|
|
|
| |
JsonGenerator can now create objects and array-nested objects, with and without
pretty printing. The test suite has been updated accordingly.
|
|
|
|
|
| |
JsonGenerator now supports nested arrays, both with and without pretty
printing. The tests suite has been updated accordingly.
|
|
|
|
|
|
|
| |
JsonGenerator now can create simple arrays, with "pretty" enabled and disabled.
Simple arrays are just one-level, value-only arrays.
The test unit has been updated to exercise this new feature.
|
|
|
|
|
|
|
| |
Now that we are providing a generator class we need to provide the
constructors and setters for JsonNode, JsonObject and JsonArray. This
also means that the json-private.h header is now useless, so we can
remove it from the build and repository.
|
|
JsonGenerator is an object that creates JSON data streams from a data
model tree. This commit adds the JsonGenerator class to the build and
API reference.
|