System.Text.Json Deserializing Nested Recursive Strings Problem #104144
Replies: 11 comments 1 reply
-
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis |
Beta Was this translation helpful? Give feedback.
-
谢谢您的来信!我会及时查阅的
|
Beta Was this translation helpful? Give feedback.
-
Can you provide more detail of this issue? What's the exact content of the
|
Beta Was this translation helpful? Give feedback.
-
I have provided json string. Anyway, directly deserializing the result is not the desired value. { |
Beta Was this translation helpful? Give feedback.
-
The json string is not enough. You are not providing a concrete invocation of the method, and what's the different from expectation. Are you calling |
Beta Was this translation helpful? Give feedback.
-
Okay, in the following two lines of code, using the Newtonsoft.Json method yields the expected result, while using System.Text. Json is not what I expected. var json=Newtonsoft.Json.JsonConvert.DeserializeObject(jsonString); |
Beta Was this translation helpful? Give feedback.
-
This line does not compile. There's no overload accepting a single string, without result type information.
How is it unexpected? Is it missing some property or child? |
Beta Was this translation helpful? Give feedback.
-
There's no problem with the code,I don't know why gitub lost the code. |
Beta Was this translation helpful? Give feedback.
-
The generic arguments are interpreted as HTML tags. You need to use code section to avoid this. Can you share the definition of DiagramJson class then? |
Beta Was this translation helpful? Give feedback.
-
oh. public class DiagramJson : DiagramBase public class DiagramBase public class DiagramChildren:DiagramBase |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Incorrect deserialization of nested recursive word JSON string
Reproduction Steps
var diagramJson=JsonSerializer.Deserialize(jsonString);
Expected behavior
{
"id": "DG1719391036524",
"type": "bpmn:Process",
"children": [
{
"id": "Event_01c21t5",
"type": "bpmn:StartEvent",
"roletype": "role",
"roles": "16b0b2cf-5fa9-4dc4-bd74-81dbee10cc44",
"children": [
{
"id": "Activity_1as9nwc",
"type": "bpmn:Task",
"roletype": "role",
"direction": "1",
"roles": "cd4104d9-c73b-478a-b116-868158636b3c",
"children": [
{
"id": "Activity_04de6if",
"type": "bpmn:Task",
"roletype": "role",
"direction": "1",
"roles": "2f814993-9ebd-44d5-9d2e-bc0297227df0",
"children": [
{
"id": "Event_06oarny",
"type": "bpmn:EndEvent",
"roletype": "role",
"direction": "1",
"endtype": "1"
}
]
},
{
"id": "Activity_0hhw92j",
"type": "bpmn:Task",
"roletype": "persion",
"direction": "1",
"users": "07e8f966-2da9-ede3-847a-693d08991c58",
"dept": "4a2535de-b3ba-40a8-8cd2-9897ca10603b",
"children": [
{
"id": "Event_06oarny",
"type": "bpmn:EndEvent",
"roletype": "role",
"direction": "1",
"endtype": "1"
}
]
}
]
}
]
}
]
}
Actual behavior
Only two layers of tree depth can be deserialized
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
Beta Was this translation helpful? Give feedback.
All reactions