cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mikedumka
Frequent Visitor

Get Value from JSON, then display value in a Time Format

Hi There, 

I am getting better at building my flows, just parsed my first JSON that was inside another array (Whoa ... I got confused just writing that). But now I have run into a problem with formatting the date time value. 

The value I pull from the JSON is "PublishedTime" with a value of "2018-11-27T22:48:00Z".

The problem is that when I try to use the expression builder I can't access the "PublishedTime" value/identifer.

The only thing availible from the Parse JSON action is "body". 

I am kind of lost ... 

Thanks, Mike

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @mikedumka,

 

You could add a Compose action inside the Apply to each, and then refer to screenshot below to create the flow:

Capture.PNG

 

The expression in the Body field as below:

formatDateTime(outputs('Compose'),'yyyy-MM-dd')

Best regards,

Alice

View solution in original post

5 REPLIES 5
v-yuazh-msft
Community Support
Community Support

Hi @mikedumka,

 

Could you please share a screenshot of the configuration of your flow?

Could you please share more details about the JSON that you mentioned.

 

I have made a test on my side and my flow works fine to get the value in the JSON as below:

 

The JSON:

[
  {
    "Title": "1",
    "PublishedTime": "2018-11-27T08:00:00Z"
  }
]

The flow:

Capture.PNG 

 

Run history:

Capture.PNG

 

Please share more details so we would try to provide a proper workaround for you.

 

Best regards,

Alice

Thanks so much for the help ... 

 

I should have explained more, I can do everything you laid out, but when it comes to the expression builder, I want to format the time. So I have this ... which has the correct JSON value "PublishedTime"

 

2018-12-06_10-44-29.png

 

But as soon as I go into the "Expression" tab and try to format the time, the JSON value changes to "body" like below ... 

2018-12-06_10-48-10.png

 

What is going on with this ... and again, thank you so much for the help!

 

Hi @mikedumka,

 

You could add a Compose action inside the Apply to each, and then refer to screenshot below to create the flow:

Capture.PNG

 

The expression in the Body field as below:

formatDateTime(outputs('Compose'),'yyyy-MM-dd')

Best regards,

Alice

View solution in original post

I tried to accept this as a solution but am getting some strange authentication error, but thank you SO much for yelp. Worked like a charm. My only question is why do I have to use 'compose' rather than working with the value directly?

HI mike, You can do this an easy way. If you add the Dynamic content that you want in any part of an action ( this could be a compose). Then click in this field . Then Ctrl A and the Ctrl V it into the expressions editor then you will get the json to query what you want. Important note for this approach you will need to remove the @ sign and the curly brackets {} around the expression that you actually want.

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.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Users online (1,466)