I have a string returned from a web service containing a JSON string.
Some of the properties in the string are base 64 encoded. Trouble is they are not base64 encoded in a consistent way. As per https://en.wikipedia.org/wiki/Base64#Implementations_and_history there is some variation in base64 encoding. I know what I'm expecting, and I need to preprocess a certain property value before decoding an deserializing it. I'm looking for the hooks in JsonConvert.DeserializeObject()
or JsonSerializerSettings
in order to do that.
To be clear, the json I need to deserialize includes multiple properties with base 64 encoding. Some have / + and padding, others have _ - and no padding. The latter causes an exception:
"The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. "