AXForum  
Go Back   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
All
Forgotten Your Password?
Register Forum Rules FAQ Members List Today's Posts Search Mark Forums Read

 
 
Thread Tools Search this Thread Display Modes
Old 11.04.2022, 19:14   #1  
Blog bot is offline
Blog bot
Участник
 
25,492 / 846 (79) +++++++
Join Date: 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, напишите личное сообщение администратору.
 

Similar Threads
Thread Thread Starter Forum Replies Last Post
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Рейтинг@Mail.ru
All times are GMT +3. The time now is 17:34.
Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Contacts, Advertising.