jsonMarshal
performs JSON style character escaping on an XML field and, for complex objects, serialises them to a JSON string (example)xmlMarshal
performs the equivalent conversion from JSON to XML (example).
in the template refers to the entire input, whereas something like .myField
refers to just the myField
field of the input|
joins together the things either side of it, which is typically input data on the left and a receiving command to process the data on the right, such as jsonMarshal
{{ . | jsonMarshal }}
will pass the entire input to the jsonMarshal
helper function.
myFunction
that accepts one parameter:
value1
and value2
value_list
to transformed_list
user-id
extracted from the session metadataclient-ip
logging the client IPreq-type
that logs the value provided in query parameter type
uid
= user123
192.0.0.1
type
= strict
.value1
accesses the “value1” field of the input JSON._tyk_meta.uid
injects the “uid” session metadata value._tyk_context.remote_addr
injects the client IP address from the context._tyk_context.request_data.param.type
injects query parameter “type”uid
= user123
192.0.0.1
type
= strict
.data.body.value1
accesses the “value1” field of the input XML._tyk_meta.uid
injects the “uid” session metadata value._tyk_context.remote_addr
injects the client IP address from the context._tyk_context.request_data.param.type
injects query parameter “type”jsonMarshal
function converts XML formatted input into JSON, for example:
Input
xmlMarshal
function converts JSON formatted input into XML, for example:
Input