Forums de discussion

Return Entity from Service builder as JSON

Nilang I Patel, modifié il y a 7 années.

Return Entity from Service builder as JSON

Junior Member Publications: 31 Date d'inscription: 26/07/11 Publications récentes
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, modifié il y a 7 années.

RE: Return Entity from Service builder as JSON

Liferay Legend Publications: 14919 Date d'inscription: 02/09/06 Publications récentes
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, modifié il y a 7 années.

RE: Return Entity from Service builder as JSON

Junior Member Publications: 31 Date d'inscription: 26/07/11 Publications récentes
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, modifié il y a 7 années.

RE: Return Entity from Service builder as JSON

Liferay Legend Publications: 14919 Date d'inscription: 02/09/06 Publications récentes
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.