cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ProfileCrater3
Helper IV
Helper IV

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! 🤮

@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?

@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😅

ProfileCrater3
Helper IV
Helper IV

@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.

ProfileCrater3
Helper IV
Helper IV

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

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors
Users online (60,529)