pub fn dict(value: Option<Value>, update_with: Kwargs) -> Result<Value, Error>
Expand description
Creates a dictionary.
This is a convenient alternative for a dictionary literal.
{"foo": "bar"}
is the same as dict(foo="bar")
.
<script>const CONFIG = {{ dict(
DEBUG=true,
API_URL_PREFIX="/api"
)|tojson }};</script>
Additionally this can be used to merge objects by passing extra keyword arguments:
{% set new_dict = dict(old_dict, extra_value=2) %}