Object filters

isObject

Check a value is the language type of Object.

Input

{{ { country: "england" } | isObject }}
{{ ["england", "scotland", "wales"] | isObject }}
{{ "great britain" | isObject }}

Output

true
true
false

objectToArray

Convert an object into an array, using each object’s key as the value for id.

Input

{{ {
  "a": { name: "Sir Robert Walpole" },
  "b": { name: "Spencer Compton" },
  "c": { name: "Henry Pelham" }
} | objectToArray | dump }}

Output

[
  { id: "a", name: "Sir Robert Walpole" },
  { id: "b", name: "Spencer Compton" },
  { id: "c", name: "Henry Pelham" },
]