Deserialize JSON With Dynamic Properties
I'm trying to build a deserializer for GCP log entries, and they all seem to have the same basic structure, and it looks like our own log info gets stored in the
My problem is many different entries have different structures for their
and another entry will have labels like this:
I've already figured it's probably best to deserialize the
I have half an idea I must write a converter for the
Is a converter even the way to go, or is there an easier way to just deserialize a json property to a to a dictionary, with no real conversions needed?
textPayload property of the JSON of a log entry, but that's not really relevant.My problem is many different entries have different structures for their
labels properties. For example, one entry will have labels like this:and another entry will have labels like this:
I've already figured it's probably best to deserialize the
labels property into a dictionary rather than something vague like object or daft like dynamic, but I have no clue on how to go about this.I have half an idea I must write a converter for the
labels property, but there are other labels properties nested within properties not shown in these examples, so how do I write a converter for only the labels property at the root of the log entry json object?Is a converter even the way to go, or is there an easier way to just deserialize a json property to a to a dictionary, with no real conversions needed?