web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to get value name ...
Power Automate
Unanswered

How to get value name from Parse JSON?

(0) ShareShare
ReportReport
Posted on by 703 Super User 2024 Season 1

Hello,

 

I use the in build acitivity recognize text from an image or pdf document (where I use PDF). I converted the output to JSON and try to retrieve the 'text' value, But without succes.

 

My solution:

Compose activity: 

OkanAT_1-1677764958143.png

I tried outputs(parse_json), Gives back empty value

Error:

InvalidTemplate. Unable to process template language expressions in action 'Compose' inputs at line '0' and column '0': 'The template language expression 'body('Parse_JSON')?['lines']?[0]?['text']' cannot be evaluated because property 'lines' cannot be selected. Array elements can only be selected using an integer index. Please see https://aka.ms/logicexpressions for usage details.'.

 

Json looks like this (i would like to receive the 'naam' value.:

{
    "body": [
        {
            "@odata.type""#Microsoft.Dynamics.CRM.expando",
            "page"1,
            "lines@odata.type""#Collection(Microsoft.Dynamics.CRM.crmbaseentity)",
            "lines": [
                {
                    "@odata.type""#Microsoft.Dynamics.CRM.expando",
                    "text""Naam",
                    "boundingBox": {
                        "@odata.type""#Microsoft.Dynamics.CRM.expando",
                        "left"0.10807245973450792,
                        "top"0.30506994503707,
                        "width"0.046878592432144636,
                        "height"0.011061075629676564,
                        "polygon": {
                            "@odata.type""#Microsoft.Dynamics.CRM.expando",
                            "coordinates@odata.type""#Collection(Microsoft.Dynamics.CRM.crmbaseentity)",
                            "coordinates": [
                                {
                                    "@odata.type""#Microsoft.Dynamics.CRM.expando",
                                    "x"0.10807245973450792,
                                    "y"0.30506994503707
                                },
                                {
                                    "@odata.type""#Microsoft.Dynamics.CRM.expando",
                                    "x"0.15495105216665256,
                                    "y"0.30506994503707
                                },
                                {
                                    "@odata.type""#Microsoft.Dynamics.CRM.expando",
                                    "x"0.15364416316751173,
                                    "y"0.3161310206667466
                                },
                                {
                                    "@odata.type""#Microsoft.Dynamics.CRM.expando",
                                    "x"0.10807245973450792,
                                    "y"0.3161310206667466
                                }
                            ]
                        }
                    }
                }
 
Appreciate all help.
 
I have tried initializing an array variable, appending to it with the output of the JSON. But i still can't get the value.
What am i doing wrong? I also tried to moving the [0] before the questionmark, still didn't work.
Categories:
I have the same question (0)
  • Chriddle Profile Picture
    8,436 Super User 2025 Season 2 on at

    You don't convert anything with Parse JSON.

    The purpose of this action is to make your items available in Dynamic Content. So why don't you use that?

  • VictorIvanidze Profile Picture
    13,073 on at

    Try to use

    body('Parse_JSON')?['lines'][0]?['text']

  • OkanMTL Profile Picture
    703 Super User 2024 Season 1 on at

    Hi Victor,

    Doesn't work unfortuntately...

  • OkanMTL Profile Picture
    703 Super User 2024 Season 1 on at

    Hi Chriddle,

     

    The reason i Used Parse JSON is because i tried it with other outputs without succes. The input (results of the recognize text activity) and output of this activity is indeed the same. But does it matter to acces the name value?

     

    The only dynamic content i get from that Action is the one below, in none of them i can access the Name value directly. 

    OkanAT_0-1677830902818.png

     

  • Verified answer
    OkanMTL Profile Picture
    703 Super User 2024 Season 1 on at

    @VictorIvanidze @Chriddle 

    I cleared my mind and said lets debug one for one, once i got the values at top level I started going down. The compose function at the end to get the values I want was: 'body('Parse_JSON')?[0]?['lines']?[0]?['text']'

     

    Jeez this took way longer than it had to. Thanks guys.

  • VictorIvanidze Profile Picture
    13,073 on at

    I glad you have solved your problem, but "?['lines']?[0]?['text']'" looks strange.

    Could you try to use

    body('Parse_JSON')?[0]?['lines'][0]?['text']

    ?

  • OkanMTL Profile Picture
    703 Super User 2024 Season 1 on at

    Hi Victor,

     

    Yes, that's what i used to get the value in the end. Thanks

  • Monkey8030 Profile Picture
    10 on at

    Thanks guys! this guided me alot, sometimes you just need to move around the zeros! for me it worked with outputs(parse_json)?[purchases]?[0]?[products]?[0]  while purchases is my array within my object and then products is my array within my array of purchases. Maybe this comment helps someone!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard