I am using Struts2 with a plugin to create RESTful web services. Serialization from Java objects to JSON was a breeze - everything was correctly and beautifully displayed. Getting JSON and trying to map it to Java objects is a completely different issue.
I ran into two problems:
1) Failed to convert the JSON array to List. Solved by String [].
2) There ENUM - JSON, for example:
{"feature":{"id":2,"enabled":true,"description":"one click transactions feature","type":"ONECLICK_OPTIN_TRANSACTIONS"},"countries":["SG"],"clientId":10}
"type": "ONECLICK_OPTIN_TRANSACTIONS" should be displayed in ENUM in the Java object, but, of course, Struts2 barfs.
Has anyone successfully done this?
For reference, this is the corresponding part of the exception:
Method public java.lang.String org.apache.commons.lang.exception.NestableRuntimeException.getMessage(int) threw an exception when invoked on net.sf.ezmorph.MorphException: com.foo.bar.entity.FeatureType
Thanks Shaun
source share