Azure Logic App JSON Array Data Operation

%3CLINGO-SUB%20id%3D%22lingo-sub-1130949%22%20slang%3D%22en-US%22%3EAzure%20Logic%20App%20JSON%20Array%20Data%20Operation%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1130949%22%20slang%3D%22en-US%22%3E%3CP%3EWe%20have%20a%20scenario%20where%20we%20are%20getting%20an%20JSON%20array%20response%20from%20Hubspot%20webhook%20Ex-%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167468i83CECE0FAA9D1E33%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22clipboard_image_0.png%22%20title%3D%22clipboard_image_0.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3Ethis%20JSON%20array%20may%20have%20length%20upto%2040%20or%2050.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%20I%20want%20to%20check%3C%2FP%3E%3CP%3Eif%20'subscriptionType'%20contains%20'company'%20then%20set%20variable%20'Iscompany'%20to%20'true'%3C%2FP%3E%3CP%3Eelse%20If%26nbsp%3B'subscriptionType'%20contains%20'contact'%20then%20set%20variable%20'Iscontact'%20to%20'true'%3C%2FP%3E%3CP%3Eelse%20if%26nbsp%3B'subscriptionType'%20contains%20'company'%20and%20'contact'%20then%20set%20variable%20'Iscompany'%20and%20'Iscontact'%20to%20'true'.%26nbsp%3B%20Example-%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20712px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F167473iD37BE0F9EC626B91%2Fimage-dimensions%2F712x324%3Fv%3D1.0%22%20width%3D%22712%22%20height%3D%22324%22%20alt%3D%22clipboard_image_1.png%22%20title%3D%22clipboard_image_1.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%20the%20problem%20is%20this%20-%20suppose%20if%20there%20is%20length%20of%20JSON%20array%20is%2040%20or%2050%20and%20we%20got%20our%20variables%20'IsContact'%20and%20'IsCompany'%20is%20set%20to%20'True'%20in%20its%20first%202%20or%203%20iterations%20so%20why%20do%20i%20check%20in%20full%20array%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20any%20alternate%20way%20to%20achieve%20this%20logic-%26nbsp%3B%3C%2FP%3E%3CP%3Eif%20'subscriptionType'%20contains%20'company'%20then%20set%20variable%20'Iscompany'%20to%20'true'%3C%2FP%3E%3CP%3Eelse%20If%26nbsp%3B'subscriptionType'%20contains%20'contact'%20then%20set%20variable%20'Iscontact'%20to%20'true'%3C%2FP%3E%3CP%3Eelse%20if%26nbsp%3B'subscriptionType'%20contains%20'company'%20and%20'contact'%20then%20set%20variable%20'Iscompany'%20and%20'Iscontact'.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Elike%20if%20JSON%20Body%20contains%20'company'%20or%20'contact'%20as%20value%20of%20keys%20then%20set%20variables%20to%20true%20or%20false.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

We have a scenario where we are getting an JSON array response from Hubspot webhook Ex-

clipboard_image_0.png

this JSON array may have length upto 40 or 50.

 

Now I want to check

if 'subscriptionType' contains 'company' then set variable 'Iscompany' to 'true'

else If 'subscriptionType' contains 'contact' then set variable 'Iscontact' to 'true'

else if 'subscriptionType' contains 'company' and 'contact' then set variable 'Iscompany' and 'Iscontact' to 'true'.  Example-

clipboard_image_1.png

 

Now the problem is this - suppose if there is length of JSON array is 40 or 50 and we got our variables 'IsContact' and 'IsCompany' is set to 'True' in its first 2 or 3 iterations so why do i check in full array?

 

Is there any alternate way to achieve this logic- 

if 'subscriptionType' contains 'company' then set variable 'Iscompany' to 'true'

else If 'subscriptionType' contains 'contact' then set variable 'Iscontact' to 'true'

else if 'subscriptionType' contains 'company' and 'contact' then set variable 'Iscompany' and 'Iscontact'.

 

like if JSON Body contains 'company' or 'contact' as value of keys then set variables to true or false.

 

0 Replies