Logic app read property of json stored in variable

房东的猫 提交于 2020-12-10 07:56:07

问题


I have this json in a Logic App variable. I want to 'id' property of this JSON and use further. How to get this id property value?

My json is:

{
"id": 1,
"name": "John bright",
"username": "Lily",
"email": "abc@aabc.com",
}

回答1:


You said your json is a variable, but you don't mention which type it's stored.

  1. Stored as string. In this way the whole json is a string, it's not supported to select property. So you need parse it to Json with Parse JSON action then you will be able to select property. About the Parse JSON Schema, just click the Use sample payload to generate schema and paste your json value, it will generate. And select your property just use the @{body('Parse_JSON')?['name']}, it will work.

  1. If it's stored as an Object, it will be easier to do it, just use expression variables('test1')['name'] to get it.




回答2:


Use the Parse Json action and use your payload as a "Use sample payload to generate schema". After that, id will be listed as a Dynamic content from the Parse Json action.



来源:https://stackoverflow.com/questions/56244766/logic-app-read-property-of-json-stored-in-variable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!