Foros de discusión

Return Entity from Service builder as JSON

Nilang I Patel, modificado hace 7 años.

Return Entity from Service builder as JSON

Junior Member Mensajes: 31 Fecha de incorporación: 26/07/11 Mensajes recientes
Hi

Do we have any mechanism to return entity from service builder in form of JSON ? I am using Liferay 6.2 GA6.

Thanks & Regards
Nilang I Patel
thumbnail
David H Nebinger, modificado hace 7 años.

RE: Return Entity from Service builder as JSON

Liferay Legend Mensajes: 14916 Fecha de incorporación: 2/09/06 Mensajes recientes
If you use the remote service, Liferay will automagically return your entity as json through /api/jsonws. You don't have to do squat.
Nilang I Patel, modificado hace 7 años.

RE: Return Entity from Service builder as JSON

Junior Member Mensajes: 31 Fecha de incorporación: 26/07/11 Mensajes recientes
Hi David,

Thanks for prompt reply. Actually I was looking for a solution where I will get my entity in form of JSON for local service which I can pass to JSP to render it in specific output. Is there any way to do so (out of the box) ?

Regards
Nilang
thumbnail
David H Nebinger, modificado hace 7 años.

RE: Return Entity from Service builder as JSON

Liferay Legend Mensajes: 14916 Fecha de incorporación: 2/09/06 Mensajes recientes
Why?

Seriously, the JSP can deal with the entity in it's java form. Don't pay an extra price to marshal to/from JSON as it is not worth it.