I noticed on the tutorial for custom code that the response object is a JObject where we can put() values. I want to ask what's the preferred way to send an App42Response Object (User, Storage, etc.) as a JObject in custom-code (or if there's another way of sending it instead of as a JObject) and how I can Deserialize the response back to the desired App42Response class. I'm currently using Unity3D(C#) for my frontend, thanks.
I tried doing this, but i can't directly cast to Storage for example when I receive the response since the response is a JObject and not a Storage object:
(part of custom-code snippet in Java):
@Override
public HttpResponseObject execute(HttpRequestObject request) {
...
Storage s = storageService.saveOrUpdateDocumentByKeyValue(...);
JSONObject js = null;
try {
js = new JSONObject(s);
} catch (JSONException e) {
e.printStackTrace();
}
return new HttpResponseObject(HTTP_STATUS_SUCCESS, js);
}