serialization - how much camel caseing does CamelCasePropertyNamesContractResolver do? -


using json.net this:

jsonconvert.serializeobject(someobject,                              newtonsoft.json.formatting.none,                              new jsonserializersettings() {                                 nullvaluehandling = nullvaluehandling.ignore,                                 referenceloophandling = referenceloophandling.ignore,                                 contractresolver = new camelcasepropertynamescontractresolver()                             }); 

how camel caseing json.net do?

does lowercase letters starting @ beginning of word?

examples:

  • somepropertyid -> somepropertyid
  • somepropertyid -> somepropertyid
  • somepropertyid -> somepropertyid
  • somepropertyid -> somepropertyid

here camelcasepropertynamescontractresolver does, direct unit tests: https://github.com/jamesnk/newtonsoft.json/blob/95665429a431364327b4bce5332c39fda7819e7b/src/newtonsoft.json.tests/utilities/stringutilstests.cs#l40-l54

[test] public void tocamelcasetest() {   assert.areequal("urlvalue", stringutils.tocamelcase("urlvalue"));   assert.areequal("url", stringutils.tocamelcase("url"));   assert.areequal("id", stringutils.tocamelcase("id"));   assert.areequal("i", stringutils.tocamelcase("i"));   assert.areequal("", stringutils.tocamelcase(""));   assert.areequal(null, stringutils.tocamelcase(null));   assert.areequal("iphone", stringutils.tocamelcase("iphone"));   assert.areequal("person", stringutils.tocamelcase("person"));   assert.areequal("iphone", stringutils.tocamelcase("iphone"));   assert.areequal("i phone", stringutils.tocamelcase("i phone"));   assert.areequal(" iphone", stringutils.tocamelcase(" iphone")); } 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -