Am 21.01.2014 09:23, schrieb Kai-Heng Feng:

I am not sure how to implement this via registerRestInterface.

I've tried:

 Json rest_api(string param0, string param1) {
     Json j;
     j.id = "1";
     return j;
 }

which causes an exception with message:

 ...Got JSON of type undefined, expected object....

So, is there a formal way to return a JSON through POST?

Thanks.

This approach is supposed to be correct, the error is caused by the
Json value not being initialized to Type.object. Please try to
replace Json j; with Json j = Json.emptyObject; and see if it works.