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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Getting Data from a Cu...
Power Automate
Answered

Getting Data from a Custom Object

(0) ShareShare
ReportReport
Posted on by 431

I am making an app that talsk to chatGPT. using the Invoke Web Service action. I then used the Convert JSON to custom object action. I was able to print the text of my result using: 

%AnswerCustomObject['choices'][0].text%

I need help extracting the token details which is in the usage part of the custom object. 
 would like to extract prompt_tokens, completion_tokens, and total_tokens as 3 different variables. 

I wasn't sure of the syntax. TIA

Steve48_0-1694803509028.png

 

I have the same question (0)
  • Verified answer
    Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at

    Hi @Steve48 

     

    to get values inside the usage key, use below expression to retrive tokena value.

     

    %AnswerCustomObject['usage']['prompt_tokens']%  :  to get prompt tokens

    %AnswerCustomObject['usage']['completion_tokens']% : to get completion tokens

    %AnswerCustomObject['usage']['total_tokens']% : to get total tokens

     

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

  • Steve48 Profile Picture
    431 on at

    @Nived_Nambiar Thank you-that worked

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 261 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 185

#3
Haque Profile Picture

Haque 168

Last 30 days Overall leaderboard