| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
This commit adds json-gobject.h and json_serialize_gobject() to
JSON-GLib, to serialize a GObject instance into a JSON data stream.
|
|
|
|
|
| |
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 moved the constructors and setters for the JSON data types into
the public symbols we need to document them to get back to 100% doc coverage.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
With this commit, we reach 100% coverage.
|
|
|
|
|
| |
It seems that the parent accessor fell through. This commit implements
the declared json_node_get_parent() function.
|
| |
|
|
|
|
|
| |
Use gtk-doc to build the various bits and pieces of the API reference
for JSON-GLib.
|
|
|
|
|
| |
The comma is used as a member and element separator, so it should be
swallowed by the parser as soon as possible.
|
|
|
|
|
|
| |
This commit completes the JsonParser class by adding the ability to
parse JSON objects, either alone or inside arrays. JsonParser is now
a JSON parser.
|
|
|
|
|
|
|
| |
JsonParser uses the take variant of JsonNode setters for objects and arrays
since it's the one creating the objects. This way, we avoid leaks and the
extra complexity of unreffing the newly created complex containers after
setting them into the JsonNodes.
|
|
|
|
|
| |
When parsing a JSON node we need to correctly set up the parent node
of the newly created ones.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This huge commit removes JsonData and adds JsonNode, the generic container
for fundamental and complex data types extracted from a JSON stream. The
contents of a JsonNode can be extracted from it in form of a GValue for
fundamental types (integers, floats, strings, booleans) or in form of
JsonObject and JsonArray objects. JsonObject and JsonArray now accept
JsonNodes instead of GValues.
The JsonParser object builds the data model tree when parsing a JSON stream;
the tree can be recursed by getting the root node and walking it using the
GValue API for the fundamental types and the objects/arrays API for complex
types.
The API has been updated and the tests now recurse through the generated
data model tree.
|
|
|
|
|
|
|
| |
JsonData is like GValue, but it stores JSON data types (objects and
arrays) and allows us to retrieve them safely. This way we can actually
know the type of the objects returned by the parser and by the other
object walking functions.
|
|
|
|
|
|
| |
Since there cannot be any other token except for the comma, which we
eat anyway, there's no point in going through the switch() check
after we have finished parsing a nested array.
|
|
|
|
|
|
|
| |
Add the array parsing code. The parser identifies and builds nested
levels of arrays, but the storage is not quite right. That is a problem
of the parser object, though, so this can be considered a first raw
pass at the problem.
|
|
|
|
|
| |
JSON is an object serialisation format (thanks, RFC4627), so it can
only express objects and/or arrays as top-levels.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Initial commit for getting JsonParser to work. Because GScanner API
is old and mostly sucks, we need to do some magic with signals.
If json_parser_load_from_data() fails, the passed GError will be set
with a JSON_PARSER_ERROR code and message; unfortunately, we can't get
the nice error message out of GScanner. We can, however, override the
default message handler and make it emit a signal on the JsonParser
object.
So, to make a long story short: the GError passed to the load_from_data()
method is filled with a short error message; the *real* error message
is passed to the ::error signal handlers so they can actually use it.
GScanner should really get a way to retrieve the last error message.
|
|
|
|
|
| |
Use glib-genmarshal to generate the marshallers we need. For the
time being, we just need a (void,pointer).
|
|
JSON-GLib is a JSON parser library written with GLib and GObject.
JSON is the JavaScript Object Notation, and it's used to define objects
and object hierarchies in a human-readable way.
|