Skip to Content
0

Sender Rest Adapter- Convert XML to JSON - 1.00 value

Mar 07 at 07:15 AM

76

avatar image

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Liz Jin
Mar 08 at 05:42 AM
1

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


fractiondigits.jpg (143.9 kB)
fractiondigits2.jpg (110.0 kB)
Share
10 |10000 characters needed characters left characters exceeded
Iñaki Vila Mar 08 at 07:28 AM
0

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.


definition.jpg (10.5 kB)
rest-adapter.jpg (14.4 kB)
soapui.jpg (6.6 kB)
Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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

0