Skip to main content

decode_value

Function decode_value 

Source
pub fn decode_value(
    json: &[u8],
    depth: i64,
    flags: Flags,
) -> Result<Value, Error>
Expand description

json_decode($json, true, $depth, $flags) into the request model (serde_json::Value): PHP arrays that are lists become JSON arrays (so {"0":"a"} decodes to ["a"], as PHP’s [0 => 'a'] is a list), other arrays objects; empty objects become [].

Fails with Error::Unrepresentable where PHP decodes a number to an infinite float (1e999), which serde_json::Value cannot hold.