Azure / logicapps

Azure Logic Apps labs, samples, and tools
MIT License
358 stars 299 forks source link

Trailing zeros being dropped in HTTP request action #1102

Closed gbassi-bme closed 1 month ago

gbassi-bme commented 2 months ago

Describe the Bug with repro steps

The 'When a HTTP request is received' action is removing trailing zero's and therefore causing issues.

I have attached a postman script which shows if you send in the payload you get back a response which is dropping trailing zeros - this feels like a bug in Logic Apps.

This is tested in the new and legacy designer.

Added a schema, which makes no difference..

Also values cannot be sent as string to overcome this issue.

Screenshot 2024-07-03 132606

Input Json to logic

{

'AmountPlanned': 0.00,

'AmountPlanned1': 0.001,

'AmountPlanned2': 0.0,

'AmountPlanned3': 0.10,

'AmountPlanned4': 0.11,

'AmountPlanned5': 0.110

}

Output received

{

'AmountPlanned': 0.0,

'AmountPlanned1': 0.001,

'AmountPlanned2': 0.0,

'AmountPlanned3': 0.1,

'AmountPlanned4': 0.11,

'AmountPlanned5': 0.11

}

What type of Logic App Is this happening in?

Standard (Portal)

Are you using new designer or old designer

New Designer

Did you refer to the TSG before filing this issue? https://aka.ms/lauxtsg

Yes

Workflow JSON

{
    "definition": {
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
        "actions": {
            "Response": {
                "inputs": {
                    "body": "@triggerBody()",
                    "statusCode": 200
                },
                "kind": "Http",
                "runAfter": {},
                "type": "Response"
            }
        },
        "contentVersion": "1.0.0.0",
        "outputs": {},
        "triggers": {
            "When_a_HTTP_request_is_received": {
                "kind": "Http",
                "type": "Request"
            }
        }
    },
    "kind": "Stateful"
}

Screenshots or Videos

Screenshot 2024-07-03 132606

Browser

Edge

Additional context

No response

DevArjun23 commented 1 month ago

The would be related to the way numeric values are processed internally in any programming language. I would say this is "by design", unless you claim it is a recent regression, as the trailing zeros on the right side of the decimal point do not add any value to the numeric representation itself.

If you want to preserve the trailing zeros, consider using string data type for these values.

For example: { "AmountPlanned": "0.00", "AmountPlanned1": "0.001", "AmountPlanned2": "0.0", "AmountPlanned3": "0.10", "AmountPlanned4": "0.11", "AmountPlanned5": "0.110" }