cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Extracting Nth Value from JSON Array

Hi!

 

I'm wondering how to get the nth value from this array. In my situation, I would need to parse through all three below but not sure how to retrieve these values (effectively). I'm piggy backing from this post I made (same concept).

 

Thank you!

 

"ToughnessTemperature": [
  {
    "Key": "DropWeightTearTesting",
    "Value": null
  },
  {
    "Key": "ImpactCharpyTesting",
    "Value": null
  },
  {
    "Key": null,
    "Value": null
  }
]

 

 

ProfileCrater3_0-1613770313286.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Paulie78
Super User III
Super User III

From: 

outputs('JSON')['ToughnessTemperature']

Map: 

 

concat
(
  '"', 
  item()['Key'], 
  '": "',
  item()['Value'],
  '"'
)

 

The JSON you posted isn't valid and needs to have { and } prepended and appended for these expressions to work. Produces:

 

{
  "DropWeightTearTesting": "",
  "ImpactCharpyTesting": "",
  "": ""
}

 

View solution in original post

8 REPLIES 8
Paulie78
Super User III
Super User III

Not this again! 🤮

Anonymous
Not applicable

@Paulie78 Yes, unfortunately😕. But, good news, this is the last array I need help with. The rest I can handle (hopefully).

Paulie78
Super User III
Super User III

I’d do it for you but I’m not near a computer - why not copy the method from the previous post?

Anonymous
Not applicable

@Paulie78 Trust me, I've tried. I tweaked and tweaked the expression but I keep getting an error. I tried over 15 different expressions with no luck...hence why I am back😅

Anonymous
Not applicable

@Paulie78 I think I got it. It might be:

outputs('JSON')['ToughnessTemperature'][1]['Value']

Tying it out now! 

Paulie78
Super User III
Super User III

From: 

outputs('JSON')['ToughnessTemperature']

Map: 

 

concat
(
  '"', 
  item()['Key'], 
  '": "',
  item()['Value'],
  '"'
)

 

The JSON you posted isn't valid and needs to have { and } prepended and appended for these expressions to work. Produces:

 

{
  "DropWeightTearTesting": "",
  "ImpactCharpyTesting": "",
  "": ""
}

 

View solution in original post

Paulie78
Super User III
Super User III

The way you are trying it will also work, arguably simpler and easier. Wouldn't have worked for the one you posted yesterday, but this one it should.

Anonymous
Not applicable

@Paulie78 Yup, it surely did work! Thank you! Hopefully I won't be back anytime soon lol

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors
Users online (1,491)