Forum Discussion
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.
2 Replies
- Dario_Garrido
Noctilucent
Finally, I have decided to use Stream Profiles instead of reenconding. https://clouddocs.f5.com/api/irules/STREAM__expression.html
 
- P_K
Altostratus
You could use an iRule to intercept the request if the client request is posted in the http header
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
