The root of the problem lies in this line:
dynamic expando = /* ParseConfigToJsonWithoutNulls -> ParseJsonToExpandoObject */
where you decided to parse json*.json
files into an ExpandoObject
and not directly into a Dictionary
or some other strong type.
I bet you are using jsonJson.netNet
for the job and there are countless possibilities to deserialize jsonJSON
in such a way that ExpandoObject
is not necessary.
The properThis means that the conversion should take place during deserialization and not after that.
I suggest posting another question where you show us how you read your *.json
. Maybe then we can help you to get rid of the ExpandoObject
altogether.