Namespace

Json – 1.0

JSON parser and generator

Version1.9.3
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—2.0 The base type system library
Browse documentation
Gio—2.0 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.

since: 0.14

Reader

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

since: 0.12

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.

since: 1.2

Enumerations

NodeType

Indicates the content of a node.

Error Domains

ParserError

Error codes for JSON_PARSER_ERROR.

PathError

Error codes for JSON_PATH_ERROR.

since: 0.14

ReaderError

Error codes for JSON_READER_ERROR.

since: 0.12

Callbacks

ArrayForeach

The function to be passed to json_array_foreach_element().

since: 0.8

BoxedDeserializeFunc

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

since: 0.10

BoxedSerializeFunc

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

since: 0.10

ObjectForeach

The function to be passed to json_object_foreach_member().

since: 0.8

Functions

boxed_can_deserialize

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

since: 0.10

boxed_can_serialize

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

since: 0.10

boxed_deserialize

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

since: 0.10

boxed_register_deserialize_func

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

since: 0.10

boxed_register_serialize_func

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

since: 0.10

boxed_serialize

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

since: 0.10

construct_gobject

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

deprecated: 0.10 since: 0.4

from_string

Parses the given string and returns the corresponding JSON tree.

since: 1.2

gobject_deserialize

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

since: 0.10

gobject_from_data

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

since: 0.10

gobject_serialize

Creates a JSON tree representing the passed object instance.

since: 0.10

gobject_to_data

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

since: 0.10

gvariant_deserialize

Converts a JSON data structure to a GVariant.

since: 0.14

gvariant_deserialize_data

Converts a JSON string to a GVariant value.

since: 0.14

gvariant_serialize

Converts variant to a JSON tree.

since: 0.14

gvariant_serialize_data

Converts variant to its JSON encoded string representation.

since: 0.14

serialize_gobject

Serializes a GObject instance into a JSON data stream.

deprecated: 0.10 

string_compare

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

since: 1.2

string_equal

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

since: 1.2

string_hash

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

since: 1.2

to_string

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

since: 1.2

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.

since: 0.10

NODE_HOLDS_ARRAY

Evaluates to TRUE if the node holds a JSON array.

since: 0.10

NODE_HOLDS_NULL

Evaluates to TRUE if the node holds null.

since: 0.10

NODE_HOLDS_OBJECT

Evaluates to TRUE if the node holds a JSON object.

since: 0.10

NODE_HOLDS_VALUE

Evaluates to TRUE if the node holds a scalar value.

since: 0.10

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”).

PARSER_MAX_RECURSION_DEPTH

The maximum recursion depth for a JSON tree.

VERSION_S

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