docs/docs/policy-reference/builtins/encoding.mdx
<BuiltinTable category={"encoding"}/>
The json.marshal_with_options builtin's opts parameter accepts the following properties:
| Field | Required | Type | Default | Description |
|---|---|---|---|---|
pretty | No | bool | true if indent or prefix are declared, | |
false otherwise | Enables multi-line, human-readable JSON output ("pretty-printing"). | |||
If this property is true, then objects will be marshaled into multi-line JSON with either user-specified or default indent/prefix options. If this property is false, indent/prefix will be ignored and this builtin functions identically to json.marshal(). | ||||
indent | No | string | "\t" | |
| (Horizontal tab, character 0x09) | The string to use when indenting nested keys in the emitted JSON. One or more copies of this string will be included before child elements in every object or array. | |||
prefix | No | string | "" | |
| (empty) | The string to prefix lines with in the emitted JSON. One copy of this string will be prepended to each line. |
Default values will be used if:
opts is an empty object.opts does not contain the named property.<PlaygroundExample dir={require.context("../_examples/encoding/envoy_header_manipulation")} />