Hello all,
I'm using Struts2 with the rest-plugin to build a RESTful web services.
Serializing from Java objects to JSON was a breeze - everything mapped
correctly and beautifully. Receiving JSON and attempting to map it to Java
objects is a whole different issue.
I ran into 2 problems:
1) Could not convert JSON array to List. "Solved" it by using String[]
instead.
2) There's an ENUM is the JSON like so:
{"feature":{"id":2,"enabled":true,"description":"one click transactions
feature","type":"ONECLICK_OPTIN_TRANSACTIONS"},"countries":["SG"],"clientId":10}
"type" : "ONECLICK_OPTIN_TRANSACTIONS" should map to an ENUM in the Java
object, but of course, Struts2 barfs instead.
Has anyone successfully done this?
Thanks,
Shaun