Skip to main content

gvariant_deserialize_data

Function gvariant_deserialize_data 

Source
pub fn gvariant_deserialize_data(
    json: &str,
    signature: Option<&str>,
) -> Result<Option<Variant>, Error>
Expand description

Converts a JSON string to a GVariant value.

This function works exactly like [gvariant_deserialize()][crate::gvariant_deserialize()], but takes a JSON encoded string instead.

The string is first converted to a Node using Parser, and then json_gvariant_deserialize is called on the node.

The returned variant has a floating reference that will need to be sunk by the caller code.

§json

A JSON data string

§length

The length of @json, or -1 if NUL-terminated

§signature

A valid GVariant type string

§Returns

A newly created GVariantD compliant