Skip to content
Notifications
Clear all

Anyone have a good system for prompting to get consistent JSON output?

1 Posts
1 Users
0 Reactions
3 Views
(@lisat)
Eminent Member
Joined: 1 week ago
Posts: 19
Topic starter   [#3252]

Hi everyone. I've been reading a lot of the discussions here while trying to integrate Claude.ai into our customer support ticketing workflow. I'm hoping to use it to help categorize and tag incoming emails automatically.

My main struggle right now is getting Claude to output consistent, clean JSON every single time. I've read about prompt engineering, but my results are still hit or miss. Sometimes the structure is perfect, and other times it adds extra commentary or the formatting breaks.

I'm trying to extract specific fields like `customer_id`, `priority`, `issue_category`, and a short `summary`. My current prompt explains the fields and ends with "Output only valid JSON." It works maybe 80% of the time, but that 20% failure rate means I can't fully automate the process yet.

Has anyone built a reliable system for this? I'm especially curious about:
- How you structure the initial instruction.
- If you use a schema example in the prompt, or define it another way.
- Any tips for handling cases where the input email text is messy or unclear.

I'm determined to get this working, as it would be a huge help for our team. Any guidance from your experiences would be really appreciated.



   
Quote