Forum Discussion

DarioGB_339840's avatar
DarioGB_339840
Icon for Altostratus rankAltostratus
Feb 21, 2018

iRule to extract JSON values

Hello Community.

I would like to catch a client request with an iRule and rewrite some parameters in the payload.

My client request is a POST with a JSON payload. I figured out that special character using UTF-8 are wrong handled by F5, so I decided to encode everything using ISO-8889-1. To do so, I have followed next topic:

https://devcentral.f5.com/questions/httppayload-utf-8-encoding-issue-47171

That was fine, but my payload is so heavy (too many CPU cycles), so I was planning to extract the wrong-formed field and change it exclusively.

So, I would like to extract just the value of "name" field, encode it (already done) and replace JSON with the new value.

JSON Payload
{
...
"filterElementId": 1141,
"name": "sección almacén", <-- THIS VALUE
"productTypeId": null,
...
}

Any idea how to do so?

KR, Dario.