struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dimitris Mouchritsas <dimitris.mouchrit...@eurodyn.com>
Subject Skip parsing of property for json plugin
Date Fri, 30 May 2014 15:53:37 GMT
Hi all,

I'm using struts2-core 2.3.16.3 along with struts2-json-plugin and I 
have the following problem:

I have an entity bean, say Event which has the following 3 properties:
id, dateCreated and data

data is already a json string saved in the database.
e.g.:
Event data: 
{"id":1003,"username":"admin3","email":"test@example.com","lastname":"Lastname","f_user_type":1,"firstname":"Firstname","password":"fdhfdfh"}

Now in my struts2 action I have a List<Event> gridModel which I feed to 
a jquery grid.

My problem is that the data property string is being escaped, e.g:

{"JSON":"success","actionErrors":[],"actionMessages":[],"someId":"3","destination":null,"errorMessages":[],"errors":{},"fieldErrors":{},"gridModel":[{"data":"{\"id\":1,\"username\":\"admin\",\"email\":\"admin@example.com\",\"lastname\":\"Lastname\",\"f_user_type\":1,\"firstname\":\"Firstname\",\"password\":\"***\"}","dateCreated":"2014-05-30T18:15:10","id":46009},{"data":"{\"id\":1002,\"username\":\"admin2\",\"email\":\"test@example.com\",\"lastname\":\"Lastname\",\"f_user_type\":1,\"firstname\":\"Firstname\",\"password\":\"****\"}","dateCreated":"2014-05-30T18:15:10","id":46010},{"data":"{\"id\":1004,\"username\":\"admin4\",\"email\":\"test@example.com\",\"lastname\":\"Lastname\",\"f_user_type\":1,\"....


Is there any way to avoid this escaping? What alternatives do I have?
One idea is to just return a tiles plugin and create the json string by 
hand in a jsp.

 From what I've seen @JSON annotation does not have the option to skip 
escaping. This might be nice.

Regards
Dimitris

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message