In Liferay 7, I've customized my FooImpl.java (generated by the service builder from the Foo table) with a new field with getter/setter :
@ProviderType
public class FooImpl extends FooBaseImpl {
private String toto;
// and getter and setter
public FooImpl() {
}
}
I add this field because I want it in the Web Service response of the following method (extract from FooServiceImpl.java) :
@JSONWebService(value = "get-foos", method = "GET")
@AccessControlled(guestAccessEnabled=true)
public List<Foo> getFoos(){
...
}
Unfortunately, the JSON response doesn't include the custom field "toto".
Does someone has any idea how to do this ?
Thank you very much Daniele. I've found the answer in the documentation you've provided.
Actually, it's very simple, just add the annotation @JSON(strict = false) to your model object and all custom attributes will be serialized.
@JSON(strict = false)
@ProviderType
public class FooImpl extends FooBaseImpl {
private String toto;
// and getter and setter
public FooImpl() {
}
}