Description
I'm trying to log an object to console with JSON style using ToStringBuilder.reflectionToString from commons-lang3:3.10 but it seems generated a wrong JSON format.
Problem happening when I have a list of enums in my field list.
This is the class: public class Person { private long id; private String name; private List<MyEnum> listEnums; //getter and setter public String toString(){ return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); } }
And MyEnum:
public enum MyEnum { FOOD, SPORT, BOOK, MUSIC }
When I call toString() of Person object. It shows like this
{ "id": 1, "name": "Karl", "listEnums": [FRIDAY, MONDAY, TUESDAY] }
What I expected is:
{ "id": 1, "name": "Karl", "listEnums": ["FRIDAY", "MONDAY", "TUESDAY"] }