Enable JSON field name attributes to specify cross-hierarchy path mapping #115643
Replies: 3 comments 3 replies
-
This is DeepSeek’s JSON: "message": {
"content": "string",
"reasoning_content": "string",
"tool_calls": [
{
"id": "string",
"type": "function",
"function": {
"name": "string",
"arguments": "string"
}
}
]
} I already have a Currently, my workaround is:
|
Beta Was this translation helpful? Give feedback.
-
The approach with a custom converter should work. EDIT: Regarding your 2nd comment, which came at the same time i posted this comment here, it seems to looks like that |
Beta Was this translation helpful? Give feedback.
-
Regarding your update (your 2nd comment), what is the actual type you want to deserialize
If your intent is to get STJ's default converter, don't obtain it from the JsonSerializerOptions instance already configured with your converter. Try using |
Beta Was this translation helpful? Give feedback.
-
I want to silently complete serialization. So I specified the default converter using attributes.
However, I only want to modify certain parts of the JSON structure to match my entity.
For example, extracting fields from child objects as peer fields.
But for the remaining fields, I need them to be serialized using the default method.
Now, when I get the default converter, it recognizes the attributes and returns to my converter.
What should I do?
Beta Was this translation helpful? Give feedback.
All reactions