Fwupd.JsonObject¶
Fields¶
None
Methods¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Fwupd.JsonObject¶
A JSON object.
See also: ‘struct@FwupdJsonArray [struct@FwupdJsonNode]’
- add_array(key, json_arr)[source]¶
- Parameters:
key (
str) – dictionary keyjson_arr (
Fwupd.JsonArray) – aFwupd.JsonArray
Adds an array to the JSON object.
New in version 2.1.1.
- add_array_strv(key, value)[source]¶
-
Adds a string array to the JSON object. If the node already exists the old one is replaced.
New in version 2.1.1.
- add_bytes(key, value)[source]¶
- Parameters:
key (
str) – dictionary keyvalue (
GLib.Bytes) – value
Adds bytes to the JSON object. They will be base64 encoded as a string. If the node already exists the old one is replaced.
New in version 2.1.1.
- add_node(key, json_node)[source]¶
- Parameters:
key (
str) – dictionary keyjson_node (
Fwupd.JsonNode) – aFwupd.JsonNode
Adds a node to the JSON object. If the node already exists the old one is replaced.
New in version 2.1.1.
- add_object(key, json_obj)[source]¶
- Parameters:
key (
str) – dictionary keyjson_obj (
Fwupd.JsonObject) – aFwupd.JsonObject
Adds a different object to the JSON object.
New in version 2.1.1.
- add_raw(key, value)[source]¶
-
Adds a raw value to the JSON object. If the node already exists the old one is replaced.
New in version 2.1.1.
- add_string(key, value)[source]¶
-
Adds a string value to the JSON object. If the node already exists the old one is replaced.
New in version 2.1.1.
- clear()[source]¶
Clears the member data for the JSON object, but does not affect the refcount.
New in version 2.1.1.
- get_boolean(key)[source]¶
- Parameters:
key (
str) – dictionary key- Raises:
- Returns:
Trueif value was parsed as an integer- value:
boolean value
- Return type:
Gets a boolean from a JSON object. An error is returned if key is not the correct type.
New in version 2.1.1.
- get_boolean_with_default(key, value_default)[source]¶
- Parameters:
- Raises:
- Returns:
Trueif value was parsed as an integer- value:
boolean value
- Return type:
Gets a boolean from a JSON object. An error is returned if key is not the correct type.
New in version 2.1.1.
- get_integer(key)[source]¶
- Parameters:
key (
str) – dictionary key- Raises:
- Returns:
Trueif value was parsed as an integer- value:
integer value
- Return type:
Gets an integer from a JSON object. An error is returned if key is not the correct type.
New in version 2.1.1.
- get_integer_with_default(key, value_default)[source]¶
- Parameters:
key (
str) – dictionary keyvalue_default (
int) – value to return if key is not found, typically 0 orGObject.G_MAXINT64
- Raises:
- Returns:
Trueif value was parsed as an integer- value:
integer value
- Return type:
Gets an integer from a JSON object. An error is returned if key is not the correct type.
New in version 2.1.1.
- get_size()[source]¶
- Returns:
number of key-values added
- Return type:
Gets the size of the JSON object.
New in version 2.1.1.
- get_string_with_default(key, value_default)[source]¶
- Parameters:
- Raises:
- Returns:
a string, or
Noneon error- Return type:
Gets a string from a JSON object. An error is returned if key is not the correct type.
New in version 2.1.1.
- to_bytes(flags)[source]¶
- Parameters:
flags (
Fwupd.JsonExportFlags) – someFwupd.JsonExportFlagse.g.Fwupd.JsonExportFlags.INDENT- Returns:
- Return type:
Converts the JSON object to UTF-8 bytes.
New in version 2.1.1.
- to_string(flags)[source]¶
- Parameters:
flags (
Fwupd.JsonExportFlags) – someFwupd.JsonExportFlagse.g.Fwupd.JsonExportFlags.INDENT- Returns:
- Return type:
Converts the JSON object to a string representation.
New in version 2.1.1.