Pretty Prints a JSON field. This can be an expensive operation and you should usually do this after filtering your data — at the end of your query. This will prevent data that will be filtered out from being formatted. If the field does not contain valid JSON, the unmodified input value is stored in the output field. If no field is specified the @rawstring will be formatted.

Function Traits: FieldComputationFunction, Transformation

asstringoptional  The name of the field to store the output in.
field[a]stringoptional@rawstring The name of the field to format.
stepnumberoptional2 The indentation in number of characters, minimum 2 spaces.
strictbooleanoptionalfalse If set to true only valid JSON input produce a value in the output field. By default invalid JSON is copied to the output field unmodified.

[a] The argument name field can be omitted.

The parameter name for field can be omitted; the following forms are equivalent:




Format JSON in the @rawstring field after filtering the data.

| account=123
| json:prettyPrint()

Only copy valid JSON to the output field by setting strict=true. Here the field formattedJson will not be created for events with invalid JSON in message.

formattedJson := json:prettyPrint(field=message, strict=true)