留言板

Return Entity from Service builder as JSON

Nilang I Patel,修改在7 年前。

Return Entity from Service builder as JSON

Junior Member 帖子: 31 加入日期: 11-7-26 最近的帖子
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,修改在7 年前。

RE: Return Entity from Service builder as JSON

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
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,修改在7 年前。

RE: Return Entity from Service builder as JSON

Junior Member 帖子: 31 加入日期: 11-7-26 最近的帖子
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,修改在7 年前。

RE: Return Entity from Service builder as JSON

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
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.