Namespace

Json – 1.0

JSON parser and generator

Version1.6.7
AuthorsEmmanuele Bassi
LicenseLGPL-2.1-or-later
Website
Sourcehttps://gitlab.gnome.org/GNOME/json-glib/

Build

C headersjson-glib/json-glib.h
pkg-config filesjson-glib-1.0

Dependencies

GObject The base type system library
Browse documentation
Gio GObject interfaces and objects
Browse documentation

Classes

Builder

JsonBuilder provides an object for generating a JSON tree.

Generator

JsonGenerator provides an object for generating a JSON data stream from a tree of JsonNode instances, and put it into a buffer or a file.

Parser

JsonParser provides an object for parsing a JSON data stream, either inside a file or inside a static buffer.

Path

JsonPath is a simple class implementing the JSONPath syntax for extracting data out of a JSON tree.

Reader

JsonReader provides a simple, cursor-based API for parsing a JSON DOM.

Interfaces

Serializable

JsonSerializable is an interface for controlling the serialization and deserialization of GObject classes.

Structs

Array

JsonArray is the representation of the array type inside JSON.

Node

A generic container of JSON data types.

Object

JsonObject is the representation of the object type inside JSON.

ObjectIter

An iterator object used to iterate over the members of a JSON object.

Enumerations

NodeType

Indicates the content of a node.

Error Domains

ParserError

Error codes for JSON_PARSER_ERROR.

PathError

Error codes for JSON_PATH_ERROR.

ReaderError

Error codes for JSON_READER_ERROR.

Callbacks

ArrayForeach

The function to be passed to json_array_foreach_element().

BoxedDeserializeFunc

Deserializes the contents of the passed JsonNode into a GBoxed, for instance:

BoxedSerializeFunc

Serializes the passed GBoxed and stores it inside a JsonNode, for instance:

ObjectForeach

The function to be passed to json_object_foreach_member().

Functions

boxed_can_deserialize

Checks whether it is possible to deserialize a GBoxed of type gboxed_type from a JsonNode of type node_type.

boxed_can_serialize

Checks whether it is possible to serialize a GBoxed of type gboxed_type into a JsonNode.

boxed_deserialize

Deserializes the given JsonNode into a GBoxed of the given type.

boxed_register_deserialize_func

Registers a deserialization function for a GBoxed of type gboxed_type from a JsonNode of type node_type.

boxed_register_serialize_func

Registers a serialization function for a GBoxed of type gboxed_type to a JsonNode of type node_type.

boxed_serialize

Serializes a pointer to a GBoxed of the given type into a JsonNode.

construct_gobject

Deserializes a JSON data stream and creates an instance of the given type.

from_string

Parses the given string and returns the corresponding JSON tree.

gobject_deserialize

Creates a new GObject instance of the given type, and constructs it using the members of the object in the given node.

gobject_from_data

Deserializes a JSON data stream and creates an instance of the given type.

gobject_serialize

Creates a JSON tree representing the passed object instance.

gobject_to_data

Serializes a GObject instance into a JSON data stream, iterating recursively over each property.

gvariant_deserialize

Converts a JSON data structure to a GVariant.

gvariant_deserialize_data

Converts a JSON string to a GVariant value.

gvariant_serialize

Converts variant to a JSON tree.

gvariant_serialize_data

Converts variant to its JSON encoded string representation.

serialize_gobject

Serializes a GObject instance into a JSON data stream.

string_compare

Check whether a and b are equal UTF-8 JSON strings and return an ordering over them in strcmp() style.

string_equal

Check whether a and b are equal UTF-8 JSON strings.

string_hash

Calculate a hash value for the given key (a UTF-8 JSON string).

to_string

Generates a stringified JSON representation of the contents of the given node.

Function Macros

CHECK_VERSION

Compile-time version checking. Evaluates to TRUE if the version of JSON-GLib is greater than the required one.

ENCODE_VERSION

Encodes a JSON-GLib version in an hexadecimal number, useful for integer comparisons.

NODE_HOLDS

Evaluates to TRUE if the node holds the given type.

NODE_HOLDS_ARRAY

Evaluates to TRUE if the node holds a JSON array.

NODE_HOLDS_NULL

Evaluates to TRUE if the node holds null.

NODE_HOLDS_OBJECT

Evaluates to TRUE if the node holds a JSON object.

NODE_HOLDS_VALUE

Evaluates to TRUE if the node holds a scalar value.

NODE_TYPE

Evaluates to the JsonNodeType value contained by the node.

Constants

MAJOR_VERSION

Json major version component (e.g. 1 if JSON_VERSION is “1.2.3”)

MICRO_VERSION

Json micro version component (e.g. 3 if JSON_VERSION is “1.2.3”)

MINOR_VERSION

Json minor version component (e.g. 2 if JSON_VERSION is “1.2.3”)

VERSION_S

The version of JSON-GLib, encoded as a string, useful for printing and concatenation.