DataSetConverter4Delphi icon indicating copy to clipboard operation
DataSetConverter4Delphi copied to clipboard

LowerCase nos Fields

Open WillHubner opened this issue 3 years ago • 4 comments

Dentro da função DataSetToJSONObject quanto eu utilizo, eu coloco key := LowerCase(dataSet.Fields[i].FieldName) afim de manter um "padrão" para o JSON com as keys em letras minúsculas. Você acharia interessante colocar isso no projeto principal?

WillHubner avatar Apr 27 '21 14:04 WillHubner

Seria interessante sim. O ideal seria ter uma forma de configurar se deseja utilizar Lower, Upper, Camel ou Pascal Case. Estou envolvido em outros projetos, você acha que consegue fazer um PR com esta alteração?

ezequieljuliano avatar Jun 30 '21 00:06 ezequieljuliano

How would you implement automatic pascal/camel/snake case on field names? A lowercase / original option would be enough. Or even just adding lowercase() is fine.

attikov avatar Oct 03 '21 15:10 attikov

I believe a good solution would be to have a configuration class (could be a Singleton) that would do this definition. Here you could specify whether you want Lower, Upper, Camel or Pascal Case. By default it leaves the way it is and if configured it would take the defined value.

ezequieljuliano avatar Nov 13 '21 18:11 ezequieljuliano

Or it could be a general class (singleton) or inject at the time of using the converter. It would have to implement and see the best way. I'm short on time to do this, if anyone can do a PR.

ezequieljuliano avatar Nov 13 '21 18:11 ezequieljuliano