Utility API

Utility API — Various utility functions

Functions

Description

Various utility functions.

Functions

json_from_string ()

JsonNode *
json_from_string (const char *str,
                  GError **error);

Parses the string in str and returns a JsonNode representing the JSON tree.

In case of parsing error, this function returns NULL and sets error appropriately.

Parameters

str

a valid UTF-8 string containing JSON data

 

error

return location for a GError

 

Returns

a JsonNode, or NULL.

[transfer full]

Since: 1.2


json_to_string ()

char *
json_to_string (JsonNode *node,
                gboolean pretty);

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

Parameters

node

a JsonNode

 

pretty

whether the output should be prettyfied for printing

 

Returns

the string representation of the JsonNode.

[transfer full]

Since: 1.2

Types and Values