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 Apps / Return response as JSON
Power Apps
Unanswered

Return response as JSON

(0) ShareShare
ReportReport
Posted on by 274

Here is my prompt:

Please extract only "skills", "computer skills", "qualifications", "certifications", "license", "experience level", "location" and "state" in the text below. If no values are found, return "N/A". If the qualifications is abbreviated, please expand it using engineering terms. Convert experience level to "1 - Basic", "2 - Intermediate", "3 - Advanced" or "4 - Expert". Return only one skill and only one computer skill. Return the response formatted as JSON:

I need a PE in Maryland who is experienced in AutoCAD

 

It is returning JSON, but for a few random calls it includes some text outside of the JSON, at which point my JSON parsing fails. Does anyone know why this happens?

openAI JSON issue.JPG
Categories:
  • gbego Profile Picture
    Microsoft Employee on at

    Hi @darylvogan 

     

    Not sure why this happens. Perhaps you could try solving this by prefacing in the prompt to explicitly NOT PROVIDE any texte outside of the JSON. Don't hesitate to be super explicit on the output format you want and call out things that you don't want the model to do as well.

     

    Hope this helps.

     

    Thanks,

    Gwenael

  • darylvogan Profile Picture
    274 on at

    Thanks, but i have tried getting very specific in asking it to "not" this or "only" that but can't find the magic phrasing. I am able to reliably parse the response so it's not a showstopper but would be interested to see how this gets addressed when GPT text intersects with needing structural responses.

  • Andrew7 Profile Picture
    Microsoft Employee on at

    I would not try to force it by telling what not to do. Try telling what to do instead:

     

    You are an assistant who extracts skills into JSON. Output Json block should be enclosed in ####

     This prompt will wrap your JSON with #### for example and it would be easy to extract this block 

  • darylvogan Profile Picture
    274 on at

    thanks, but i still get stray content outside of the "####" block

  • Andrew7 Profile Picture
    Microsoft Employee on at

    Can you give prompt you are sending and output?

  • darylvogan Profile Picture
    274 on at

    You are an assistant who extracts information into JSON. Output Json block should be enclosed in ####. Please extract 'skills', 'software skills', 'license', 'experience level', 'certifications', 'city' and 'state' in the text below.. If the license is abbreviated, please expand it using engineering terms with no abbreviations. Convert experience level to '1 - Basic', '2 - Intermediate', '3 - Advanced' or '4 - Expert'.

    I need a professional engineer in Baltimore who has AutoCAD experience

    Response:

    and a Professional Engineer license.

    ####
    {
    "skills": "Engineering",
    "software skills": "AutoCAD",
    "license": "Professional Engineer",
    "experience level": "2 - Intermediate",
    "certifications": null,
    "city": "Baltimore",
    "state": "MD"
    }




  • Andrew7 Profile Picture
    Microsoft Employee on at

    Modified your prompt and tested it with GPT4. I think you need to play with the prompt and be more explicit about what you want:

    "Output Json block should start and end with ####"

    Andrew7_0-1685485496567.png

     

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 283

#3
Mohsin Ali Profile Picture

Mohsin Ali 221

Last 30 days Overall leaderboard