Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON serialization to lowercase names? #42

Closed
seanleblancicdtech opened this issue Feb 9, 2022 · 1 comment
Closed

JSON serialization to lowercase names? #42

seanleblancicdtech opened this issue Feb 9, 2022 · 1 comment
Assignees
Labels
help wanted Extra attention is needed

Comments

@seanleblancicdtech
Copy link

Is there a way to coerce these to use uppercase names?

For example, at the top level of a setr.010.001.04 message, instead of getting something like

{ "SbcptOrdr": {...

we get this:

{ "sbcptOrdr": {...

and so on for every key in the JSON output when calling .toJson().

@zubri
Copy link
Member

zubri commented Feb 23, 2022

The provided toJson is one of many options to serialize the model as JSON. It is intended to be used in combination of the fromJson that does the opposite conversion.

Said that, this default implementation is currently a conversion using GSON default naming strategy as you can see here:

For your use case, you could add a similar method within your application and set to the Gson builder another strategy, such as:

builder.setFieldNamingPolicy(UPER_CAMEL_CASE)

that I understand would produce what you expect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants