azure-logic-apps - How do I return JSON from my Azure Storage Queue?
问题描述
I have a logic app that puts JSON in a queue.
Couldn't be more simple. But then, when I use the trigger for new messages, the raw output shows this:
"body": {
"MessageId": "e705a261-f2c4",
"InsertionTime": "Tue, 02 Apr 2019 14:22:24 GMT",
"ExpirationTime": "Tue, 09 Apr 2019 14:22:24 GMT",
"PopReceipt": "AgAAAAMAAAAAA=",
"TimeNextVisible": "Tue, 02 Apr 2019 19:03:32 GMT",
"DequeueCount": "69",
"MessageText": "{\"etag\":\"\",\"ItemInternalId\":\"ab5c-4859-a755\",\"LastChangeDate\":\"2019-04-02T13:37:32.9638012Z\",\"is_current_employee\":true}"
}
This is causing me a massive headache when I go to try and use the body, especially when I pipe that raw MessageText to my Liquid Template. I tried the expression json(triggerBody())
and that does not work, it fails because of the first "/". I tried to use the Parse JSON action, but that does not work because that is just designed to map the JSON to a schema and fails because MessageText
is a string anyway.
- Is there a
JSON.parse(triggerBody())
equivalent? The docs do not show escaped JSON examples. - Am I storing the JSON improperly?
I created a NodeJS Function to literally return a JSON.parse()
with a JSON content type header. Which seems like a huge waste of resources.
EDIT: One solution I got working was to manually base64 encode when I add to queue and then @json(decodeBase64(triggerBody()?['MessageText']))
when I pull from queue. The result works but wont that encode twice under the hood?
解决方案
推荐阅读
- latitude-longitude - 8-9位纬度/经度格式
- qt - setWindowOpacity 不适用于子小部件
- java - 检查一个值是否在数组中
- firemonkey - 如何“刷新” TListBox?
- sql - 字符串雪花的日期时间
- google-analytics - ua_session_id 设置为 'non_interaction': true 修复低跳出率,但跳出率稳定在 4%
- flutter - 为什么 TabBarView 占用了额外的空间?
- javascript - 显示我的屏幕和功能以在 javascript/html 中工作的问题
- r - R ggplot用最大值注释线图
- mongodb - 仅访问 MongoDB 中的最低嵌套值