BOM in Azure Logic Apps

Posted: March 30, 2023  |  Categories: Azure

This blog tells you about BOM in Azure Logic Apps and what to do about it.

The Problem

This started with a customer request that said “Can the Brand & Pack Size values be stitched/concatenated into the Product description value?
I.e. (~ = Separator. This can be up to you. My example was with a ~)
Product Description = Product Description + ~ + Brand + ~ + Pack size”. This sounds pretty simple. The logic app simply sends a JSON message to a SFTP folder and then renames it.

Thus, I simply insert a JSON to JSON action using a liquid template in an Integration account. Sounds quick and easy. Please note the JSON message is very large approximately 1Gb.

The customer reports on testing that they can’t process message “as they are JSON with BOM”. (their words). Now the fun starts.

BOM in Azure Logic Apps

Firstly, retrieving a copy of the JSON file from the SFTP server it indeed has a BOM.

This is nasty and looks like a bug in the JSON-JSON map action. There is a byte order mark(BOM) added. Why are you doing this Microsoft?

The workaround

David Burg gives a solution here.

Thus, I added this piece of Logic App definition language snippet to my Logic App.

replace(string(body('Transform_JSON_to_JSON')),'\uFEFF','')
A bit ugly but it works. The JSON message does not have BOM in it now.

Conclusion

The Transform JSON to JSON Logic App action is adding a BOM and I have shown how to work around this. Does this occur all the time? Can anyone confirm this? If so it is a bug and I think it should be fixed.

turbo360

Back to Top