Forum Discussion
JSON Base64 Token in iRule
Hello Folks,
Did anyone work on generating JSON token on F5? I need the token format as below: {
"userid": "mm36",
"Name": "Casey",
"userid": "12345",
"SomeList":
[
"12345-001",
"32124-005"
],
{
"Id": 12345,
"queue": 1,
"place": "USA"
},
"userRole": "associate",
"levels":
[
"networkengineer",
"analyst",
"admin",
]
}
I currently have the below JSON in irule that is working & generating the token. But when i decode the token, i'm not getting the above format. I'm missing the brackets for someLists, Details & levels..
set json [b64encode "{\"userid\":\"$userid\",\"Name\":\"$Name\",\"SomeList\":[\"$SomeList\"]\,\"Details\":{\"$Details\"},\"userRole\":\"$userRole\",\"levels\":\"$levels\"}"]
Can someone help me if this is the actual way to write a JSON in iRule?
Any help is appreciated.. Thanks
- Stanislas_Piro2Cumulonimbus
Hi,
,{
,}
and[
must be escaped.]
set json [b64encode "{\"userid\":\"$userid\",\"Name\":\"$Name\",\"SomeList\":\[\"$SomeList\"\]\,\"Details\":\{\"$Details\"\},\"userRole\":\"$userRole\",\"levels\":\"$levels\"\}"]
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