Forum Discussion
donpacote
8 years agoHelper
you can use GSON to convert string to json
- jferrandis8 years agoExpertThanks but is this class available in freemarker?
If not, is there a way to add it ?- donpacote8 years agoHelperi dont know, i just use eclipse to develop
- donpacote8 years agoHelper
i put my code
protected <T> T fromJson(byte[] data, Class<T> modelClass) {
return gson.fromJson(new String(data), modelClass);
}protected String toJson(Object object) {
return gson.toJson(object);
}public List makeResponse(HttpResponse httpResponse, LithiumRequest lithiumRequest) {
return Collections.singletonList(fromJson(httpResponse.getData(), getModelClass()));
}- SuzieH8 years agoKhoros Alumni (Retired)
Hi jferrandis We don't provide a special FreeMarker call for this. You might want to add this to our Product Ideas board.
Related Content
- 2 months ago