© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•7mo ago•
10 replies
VoidPointer

Recursive, or Nested, JSON Parsing

I'm trying to design a viewer for JSON downloads of GCP log entries, and an example of the start of an entry looks like the image. You see, with my explanation, that the
textPayload
textPayload
and
label.session
label.session
properties contain "nested" JSON, which is escaped, and these JSON strings sometimes contain further "nested" JSON objects.

I would like a viewer that can show e.g.
textPayload
textPayload
as a collapsed node of a tree, at the same level as its peer properties, like
insertId
insertId
,
timestamp
timestamp
, and
severity
severity
, which will cannot be collapsed or expanded. Then anothed collapsed node for
labels
labels
, and under it another collapsed node for
session
session
.

Then if I expand say the
textPayload
textPayload
node, it displays that nested JSON object as a normal tree under
textPayload
textPayload
. The shape of this nested object is not fixed, so manually deserializing it if a user clicks its
+
+
icon is difficult.

I would prefer to somehow dynamically deserialize the whole log entry at once, using some sort of JsonNode or JsonObject classes in a tree structure instead of deserializing into a hierarchy of static, known, object types. I only really need the next of each JSON property node in the log entry, I don't need to work with any defined C# types for these nodes.
image.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Parsing JSON
C#CC# / help
4y ago
JSON Parsing to TreeView
C#CC# / help
2y ago
❔ Newtonsoft.JSON Nested Json deserialized incorrectly
C#CC# / help
4y ago
✅ Deserializing nested array json file.
C#CC# / help
2y ago