Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
# params = { 'param_key_1' => 'param_val_1', 'param_key_2' => 'param_val_2' }
{{ params | to_json }}

Output:

Code Block
[["param_key_1", "param_val_1"], ["param_key_2", "param_val_2"]]

If you want to convert a hash to key/value JSON, you can pass true as an argument. Plate Objects get converted to key/value JSON regardless of the passed argument.

Input:

Code Block
# params = { 'param_key_1' => 'param_val_1', 'param_key_2' => 'param_val_2' }
{{ params | to_json: true }}

Output:

Code Block
{"param_key_1": "param_val_1", "param_key_2": "param_val_2"}

...