Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion agent-framework/tutorials/agents/structured-output.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ var response = await agent.RunAsync("Please provide information about John Smith
The agent response can then be deserialized into the `PersonInfo` class using the `Deserialize<T>` method on the response object.

```csharp
var personInfo = response.Deserialize<PersonInfo>(JsonSerializerOptions.Web);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marknhenry, this code looks correct to me. Isn't AgentRunResponse.Deserialize working for you?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it's not running for me. The issue is in JsonSerializerOptions.Web.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the failure you are seeing?

var personInfo = JsonSerializer.Deserialize<PersonInfo>(response.ToString(), new JsonSerializerOptions(JsonSerializerDefaults.Web));
Console.WriteLine($"Name: {personInfo.Name}, Age: {personInfo.Age}, Occupation: {personInfo.Occupation}");
```

Expand Down