Function build_query_string

Source
pub fn build_query_string(
    params: &BTreeMap<String, Value>,
) -> Result<String, Error>
Expand description

Builds a query string from a map of key-value parameters.

Converts various JSON Value types into URL query string segments, handling:

  • Strings, booleans, and numbers as direct key-value pairs
  • Arrays of strings, booleans, or numbers as comma-separated values
  • Nested arrays serialized as JSON strings

§Arguments

  • params - A map of parameter names to their corresponding JSON values

§Returns

  • Result<String, anyhow::Error> - A query string with URL-encoded parameters, or an error

§Errors

Returns an error if an object value is encountered or JSON serialization fails