This post is mostly a repro for the Logic App team.

Converting to string

If I have a Logic App that uses a JSON schema, and that schema contains a property of type NUMBER, the conversion to string changes the value in a very strange way. If I feel in the number 0.000092 it gets converted to “9.2E-05”. This is mathematically correct, but it seems like it is handling an overflow error. Now this is usually not a problem, unless you want to store an incoming JSON in a blob file. In that case, the payload gets converted to a string implicitly and therefore the same conversion error occurs.

If I get this payload in a request:

{
“NumberValue”: 0.000092,
“StringValue”: “0.000092”
}

And configure the response to return:
[“@triggerBody()?[‘NumberValue’]”]

The response looks like:
[0.000092]

But if I convert it to a string, like this:
[“@string(triggerBody()?[‘NumberValue’]”)]

The response looks like this:
[“9.2E-05”]

This gets really bad when you try to store the body of an incoming message in a Blob Storage container using the connector, because this body:
{
“NumberValue”: 0.000092,
“StringValue”: “0.000092”
}

Get converted into this:
{“NumberValue”:9.2E-05,”StringValue”:”0.000092″}

Which is far from ideal. This is also true if you convert the number value or string values using the binary-function.

Overflow problem

I think I would put the blame on the number conversion functionality behind the scenes. This is also supported by the fact that the value 0.00092 (one less 0) gets converted to “0.00092”.

Has anyone else had this issue, and how did you solve it?

The json for this logic app can be found here.