Skip to main content

compact_array

Function compact_array 

Source
pub fn compact_array(
    active_ctx: &JsonLdContext,
    active_property: &str,
    array: &[JsonLdValue],
    options: &CompactionOptions,
) -> Result<JsonLdValue, CompactionError>
Expand description

Compact an array of JSON-LD values.

If compact_arrays=true and the array has exactly one element, and the active property’s container does not require an array, the element is returned unwrapped (as a scalar).

§Arguments

  • active_ctx — the active context
  • active_property — the property under which this array appears
  • array — the array elements to compact
  • options — compaction options