Stack Overflow archive
7 scoreaccepted

In GSON, how to work with JSON attributes containing space?

score
7
question views
1.9K
license
CC BY-SA 3.0

You can parse JSON keys with whitespace with Gson by using SerializedName annotation.

Example:

java
@SerializedName("Date of Event") public String dateOfEvent;

Originally posted on Stack Overflow. Public user contributions are licensed under Creative Commons Attribution-ShareAlike.