Forum Discussion
Chris_123510
Nimbostratus
Nov 20, 2013Using iRules for JSON response
I am looking for examples of how to set up the LTM to respond to JSON requests using an iRule. When we send back the HTML response page it is locking up our vendors system, so we would like to change...
Kevin_Stewart
Employee
Nov 21, 2013You'd have to escape the special characters, but the method should be the same. Example:
when HTTP_REQUEST {
set json "{ \"glossary\": { \"title\": \"example glossary\", \"GlossDiv\": { \"title\": \"S\", \"GlossList\": { \"GlossEntry\": { \"ID\": \"SGML\", \"SortAs\": \"SGML\", \"GlossTerm\": \"Standard Generalized Markup Language\", \"Acronym\": \"SGML\", \"Abbrev\": \"ISO 8879:1986\", \"GlossDef\": { \"para\": \"A meta-markup language, used to create markup languages such as DocBook.\", \"GlossSeeAlso\": \[\"GML\", \"XML\"\] }, \"GlossSee\": \"markup\" } } } } }"
HTTP::respond 200 content $json "Content-Type" "application/json"
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects
