Function variant_to_json_value

Source
pub fn variant_to_json_value(
    variant: &Variant<'_, '_>,
) -> Result<Value, ArrowError>
Expand description

Convert [Variant] to serde_json::Value

This function converts a Variant to a serde_json::Value, which is useful when you need to work with the JSON data programmatically or integrate with other serde-based JSON processing.

§Arguments

  • variant - The Variant value to convert

§Returns

  • Ok(Value) containing the JSON value
  • Err with error details if conversion fails

§Examples

let variant = Variant::from("hello");
let json_value = variant_to_json_value(&variant)?;
assert_eq!(json_value, Value::String("hello".to_string()));