I have a pre defined json that has the following variable assigned to a JSON Object:
{
....
"class": "P"
....
}
Trouble is, I'm using the Struts 2 JSON plugin and the following code:
private String class
is not allowed, since class is a reserved keyword. Does anyone know of a way to override the variable names in Struts 2's JSON plugin?
You can use getClass()
instead, also there's @JSON
annotation where you can specify name.