Joe Eng
Joe Eng

Reputation: 1214

Azure Logic Apps - invalid json parameter error

Update: the problem was with the file encoding. See answer.

I've got a json payload that is 15.7 MB coming from blob storage. When I pass the output to a ParseJson action I use the json() converter function, but I get this error:

Unable to process template language expressions in action 'Parse_JSON' inputs at line '1' and column '2792': 'The template language function 'json' parameter is not valid.

Then I took the same json file and stripped it down to 1 KB and tested with the same Logic App and it worked. So is there a size limit for json()?

Upvotes: 0

Views: 2760

Answers (1)

Joe Eng
Joe Eng

Reputation: 1214

The problem was that the stream was written with a byte order mark (BOM) added at the start of the text, so it was not recognized as valid JSON. StreamWriter was used to write to the stream with UTF8 encoding. The fix was to not specify the encoding in the constructor, which defaults to an instance of UTF8 without a BOM:

https://learn.microsoft.com/en-us/dotnet/api/system.io.streamwriter?view=netframework-4.7.2#remarks

Upvotes: 1

Related Questions