Note: this is not a very robust way to code it, since the JSON string you create depends on the name we use for a constant in Java. I do this too, but only in places where the string does not matter (so I just need a readable representation for the enum constant). In your case, the string is already defined by the JSON format, so one should better not rely on the Java name.