Skip to content

Parse JSON with PascalCase property names #157

Answered by zubri
gediminasmorkys asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

The fromJson is basically and abstraction of Gson where the JSON structure matches the jaxb generated model. Thus you can create your own Gson instance and use it, instead of the library fromJson

final Gson gson = getGsonBuilderWithCustomAdapters() .registerTypeAdapter(OffsetDateTime.class, new OffsetDateTimeJsonAdapter()) .setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE) .setPrettyPrinting() .create();

Notice I've added the offset date time adapter in the example above, since this is the current version of the library. We have just made the main branch compatible with Java 11, Jakarta and java.time.

The Java 8 code was moved to a java8-maintenance branch.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@gediminasmorkys
Comment options

Answer selected by gediminasmorkys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants