I'd like to convert the JSON string
"{ "birthday": "1988-03-18", "address": { "state": 24, "city": 8341, "country": 1 } }"
to
"{ "address": { "city": 8341, "country": 1, "state": 24 }, "birthday": "1988-03-18" }"
NOTE: I'm not using the sorted version for communication (because the key order doesn't really matter), I need a sorted version to perform local tests (by comparing JSON strings).
EDIT: I4V pointed a solution that uses Json.Net, I would rather use a solution that doesn't need to include any 3rd party library (actually I'm using the built in System.Json in my application)
I posted a gist with the solution provided by I4V + some testing here. Thank you all.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…