Forum Discussion

Guillaume_Rouss's avatar
Guillaume_Rouss
Icon for Nimbostratus rankNimbostratus
Aug 19, 2020

Creating JSON content in irule

Hello.

I'm using an irule to send traffic logs to a remote syslog server, using JSON format. Currently I'm creating JSON content manually, using format function, ie:

set message [format {{ "key1":"%s", "key2":"%s", ... }} $value1 $value2 ... ]
HSL::send $hsl $message

However, this is a bit painful, especially as the number of key/value pairs rise, and doesn't handle internal escaping of characters inside values. Is there a better way to create JSON content in irule ?