AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 11.04.2022, 19:14   #1  
Blog bot is offline
Blog bot
Участник
 
25,631 / 848 (80) +++++++
Регистрация: 28.10.2006
crmtipoftheday: Tip #1437: Duplicate property names in JSON objects in Power Automate
Источник: https://crmtipoftheday.com/1437/dupl...power-automate
==============

From time to time you may be forced to deal with JSON objects in Power Automate that contain duplicate property names. Consider this object, for example:

{ "Id": 42, "Name": "Fixing the machine", "From": "Edison", "Total": 1000, "Items": [ { "Id": 1, "Name": "Hammering", "Subtotal": 1 }, { "Id": 2, "Name": "Knowing Where to Hammer", "Subtotal": 999 } ]}
To make this object maker-friendly, the common approach is to use Parse JSON action and derive schema from the data itself.

When done, maker can use properties as dynamic values. In our data, unfortunately, some properties have identical names (Id and Name) even though their path is different.

As it turns out, object schema can be enriched with “title” and “description” annotations. For example, let’s describe Ids and Names

{ "type": "object", "properties": { "Id": { "type": "integer", "title": "Invoice ID", "description": "Unique invoice identifier" }, "Name": { "type": "string", "title": "Invoice name" }, "From": { "type": "string" }, "Total": { "type": "integer" }, "Items": { "type": "array", "items": { "type": "object", "properties": { "Id": { "type": "integer", "title": "Invoice line item ID", "description": "Line item number unique within the invoice" }, "Name": { "type": "string", "description": "Line item name, not to be confused with invoice name" }, "Subtotal": { "type": "integer" } }, "required": [ "Id", "Name", "Subtotal" ] } } }}
The result is the game changer:

Now you can have your JSON and eat it too.

Cover photo by Natalia Yakovleva on Unsplash



Источник: https://crmtipoftheday.com/1437/dupl...power-automate
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
crmtipoftheday: Tip #1429: Replace Power Automate triggers without breaking too much, Part 2 Blog bot Dynamics CRM: Blogs 0 11.03.2022 18:12
crmtipoftheday: Tip #1426: Power Automate Gymnastics Reference Guide Blog bot Dynamics CRM: Blogs 0 09.02.2022 14:12
crminthefield: Dynamics 365 and Power Platform Monthly Update-September 2021 Blog bot Dynamics CRM: Blogs 0 11.09.2021 09:04
crminthefield: Dynamics 365 and Power Platform Monthly Update-August 2021 Blog bot Dynamics CRM: Blogs 0 12.08.2021 06:20
crminthefield: Dynamics 365 and Power Platform Monthly Update-July 2021 Blog bot Dynamics CRM: Blogs 0 14.07.2021 02:22

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 22:22.