cancel
Showing results for 
Search instead for 
Did you mean: 

Sender Rest Adapter- Convert XML to JSON - 1.00 value

iaki_vila
Active Contributor
0 Kudos

Hi experts.

On the sender rest adapter i have the xml value 1.00 if i set the conversion to JSON:

1. Nothing: the adapter converts it in a string, i get: "1.00".

2. Custom XML/JSON conversion Rules, type decimal or float, i get: 1
3. Custom XML/JSON conversion Rules, type decimal or float, default value 0.00, i get: 1

Is there any possibility to get the value 1.00, as a number, with the point and the decimal values?

Regards.

Accepted Solutions (0)

Answers (3)

Answers (3)

Liz_
Product and Topic Expert
Product and Topic Expert

Hello Iñaki,

In ESR, data type definition, you set a field as Decimal, and if you click the "show data sheet" button, you will find the parameter fractionDigits which determines the number of displayed decimal places. For your case, you can set it 2, and you will get the value 1.00. For more details, check the following screenshots:

Best Regards,

Liz

k3n_sap
Discoverer
0 Kudos

Hi Iñaki Vila

Do you solve the problem with the decimals without .00?

Kind regards.

iaki_vila
Active Contributor
0 Kudos

Hi Liz,

I set the type as you said:

And in the Rest adapter as well:

But when the decimal value is .00, the decimal values are not showed:

In monitoring before Rest proccesing i can see the two decimal values.

What is your PI version and your PI SP?

Regards.

joan_llaully
Discoverer
0 Kudos

Hi Iñaki, did you find any solution for this? I'm having a similar problem but in receiver side. I'm sending from PI value 10.504, but after conversion in channel (using conversion XML/JSON custom rules), JSON value is 10.5

Anyone has a similar issue?

Best regards,

Joan Llaully