I have incoming messages that I need to try and analyze in my own object structure. SOme of them are well-formed JSON obejcts, and some are just nonsense.
I am using JsonConvert.DeserializeObject<MyObject>(incmoingString); for this. This, however, sometimes gives me an exception when incoming full garbage. In other cases, I get an incomplete object structure when the incoming line looks OK - and finally it sometimes works.
I wrapped the conversion in try / catch and, than manually, confirmed that I have the properties necessary for a deserialized result.
Is there a better way to do this?
Riiri
source share