REST Binding / ParseJSON not allowing for leading zeros
book
Article ID: KB0078658
calendar_today
Updated On:
Products
Versions
TIBCO ActiveMatrix BusinessWorks
6.x
Description
This article talks about how to consume a JSON message that has integer field with leading zeros e.g (001,01203).
Issue/Introduction
REST Binding / ParseJSON not allowing for leading zeros
Resolution
JSON specification does not allow leading zeros. There are two ways to deal with this:
1. Use string type instead of the number (decimal, int, etc).
2. If you can not change anything at client side then implement a HTTP Proxy process. This will receive the leading 0 element, transform it into string and then using http request activity you can pass the same to actual service which is configured to receive string type. Sample project is attached.
Client -> HTTP Proxy (transform number to string) -> Service (config to receive string type)