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 / Copilot Studio / Generative Answers Var...
Copilot Studio
Suggested Answer

Generative Answers Variable issues inside copilot studio

(0) ShareShare
ReportReport
Posted on by
I’m trying to extract two values example name and city (from userinput message) from a Generative Response JSON using ParseJSON(), but Copilot Studio keeps throwing ‘JSON could not be parsed’ even though the formula validates. Has anyone solved this issue where the runtime value includes hidden extra characters and breaks JSON parsing?

which is in key value par 
{"name": "Microsoft", "City": "NYC"}



so extracting it using Text(ParseJson(topic.agentextractedvalue).Name)

can someone help me on this?
 
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,335 Super User 2025 Season 2 on at
     
    Can you share the actual input from the user, what it looks like from the Activities tab.
     
    Does it ever work? Are you getting this in the designer or at real published run time?
  • VY-13120534-0 Profile Picture
    on at
    this is the error message i am getting. 
     
    I wrote this prompt
    You are an AI assistant that extracts structured data from user input.
     
    UserText:
     
    Activity.Text
    string
     
    Extract the following values if present:
    • ProjectArea
    • RequestType
    Return the result in JSON format like this:
     

    {Topic.ProjectArea}: " ",
    {Topic.RequestType}: " "
     
    If a value is missing, leave it as an empty string.
    inside prompt session of generative answers
     
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,335 Super User 2025 Season 2 on at
     
    This is not valid JSON and it depends on if you want it to be two properties of a single or separate things
     
    {Topic.ProjectArea}: " ",
    {Topic.RequestType}: " "
    This is valid JSON
    {
      "Topic.ProjectArea": "",
      "Topic.RequestType": ""
    }
     
    or even 
     
    [
      {
        "Topic.ProjectArea": "",
        "Topic.RequestType": ""
      }
    ]
     
    But what you pasted is not.
     
    Also have you thought about making them Entities so they are easily extracted?
     
    OH And it looks like you are placing Topic.XXX where the JSON name should be, but that would make it Dynaimc, which ... I don't know of that is ok or not because its going to actually put a value.
     
    What I mean is
     
    If Topic.ProjectArea is = "Boo" then you are going to have Boo = "", is that what you really want, or do you want the actual value that was returned to be set equal to a Name called "Topic.ProjectArea", or are you trying to set a variable value? which again would look like Boo = "something" and not sure how that makes sense.

    If these suggestions help resolve your issue, Please consider Marking the answer as such and also maybe a like.

    Thank you!
    Sincerely, Michael Gernaey

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 > Copilot Studio

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 255 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 205 Super User 2025 Season 2

#3
S-Venkadesh Profile Picture

S-Venkadesh 101 Moderator

Last 30 days Overall leaderboard