I have a string of JSON and the keys have uppercase and lowercase characters:
{"employees":[
{"FIrstName":"John", "LASTname":"Doe"},
{"FIRSTNAME":"Anna", "LaSTNaME":"Smith"},
{"firstName":"Peter", "lastName":"Jones"}
]}
I want convert it to a JToken
object and have all the keys in the JToken
be lowercase. So internally in the JToken
it should be as follows:
{"employees":[
{"firstname":"John", "lastname":"Doe"},
{"firstname":"Anna", "lastname":"Smith"},
{"firstname":"Peter", "lastname":"Jones"}
]}
Previously I was using JToken json = JToken.Parse(jsonString);
to convert, but I can't find out how to make the keys lowercase. Any ideas?
The reason why I need to do this is so that my JsonSchema
validation will be case insensitive.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…