ahausladen / JsonDataObjects

JSON parser for Delphi 2009 and newer
MIT License
414 stars 160 forks source link

Add support to convert names to lowercaseStartingCamelCase #30

Closed cesarliws closed 8 years ago

cesarliws commented 8 years ago

I'm using JsonDataObjects to serialize DTO to send to Java REST Server, but the Java serializer does not recognize Names with UpperCaseStartingCamelCase, it must be lowercaseStartingCamelCase, and I cannot change the property names in Delphi Objects, I have to follow the Delphi Naming convention.

To workaround this problem, I changed TJsonObject.FromSimpleObject, to convert property name

if StartNamesLowerCase then
  PropName := LowerCase(UTF8ToString(PropList[Index].Name).Chars[0]) + UTF8ToString(PropList[Index].Name).Substring(1)
else
  PropName := UTF8ToString(PropList[Index].Name);

Is possible to have this feature built in?

brunosanson commented 8 years ago

:+1:

zuobaoquan commented 8 years ago

There are many additional requirements about serialization. lowercase is a common one.