Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Issue with Application Integration JSON Data Mapping for Integer Values

Hi Team,

I am creating an integration using Application Integration where I am passing an Integer value inside a JSON Object via a trigger. In Data Mapping task, while mapping JSON(Input) -> JSON(Output), the JSON(Output) variable explicitly adds '.0' in the integer field inside the json object as a default value. So, the endpoint where I am sending the data is passing the input as '20.0' even though the defined data type is INT. Due to that, the endpoint is not accepting the value.

Kindly suggest how this can be rectified.

Solved Solved
1 2 628
1 ACCEPTED SOLUTION

Most of the tasks/connectors(If you can let us know which task you are using, we can help you with that specifically) accept request payloads as a string. 

As phertzog has pointed out you can convert these json to string. If you use the following data transformer script, then doubles with .0 will be automatically be converted to integer(1.0 becomes 1): 

{
"json_string": std.toString(f.extVar("json"))
}

Let me know if you have any more questions ?

View solution in original post

2 REPLIES 2

Hello,

I experienced the same issue. I was able to bypass it by using a text property for my Json. The endpoint was accepting the Json payload and was converting the incoming string as an integer.

Of course this only works if your endpoint is "cooperative".

Regards

Most of the tasks/connectors(If you can let us know which task you are using, we can help you with that specifically) accept request payloads as a string. 

As phertzog has pointed out you can convert these json to string. If you use the following data transformer script, then doubles with .0 will be automatically be converted to integer(1.0 becomes 1): 

{
"json_string": std.toString(f.extVar("json"))
}

Let me know if you have any more questions ?

Top Solution Authors