struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shaun Lim <>
Subject Struts2 with rest-plugin: Map JSON value to ENUM
Date Fri, 12 Oct 2012 05:20:49 GMT
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[]

2) There's an ENUM is the JSON like so:

{"feature":{"id":2,"enabled":true,"description":"one click transactions

"type" : "ONECLICK_OPTIN_TRANSACTIONS" should map to an ENUM in the Java
object, but of course, Struts2 barfs instead.

Has anyone successfully done this?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message