The result in this case is an array of objects. Therefore, you should use them as an array:
var image=result[0].image;
var html=result[1].html;
It would be better if just returning one object:
JsonObject obj1 = new JsonObject();
JsonElement element = data.toJsonTree(imgstr);
obj1.add("image", element);
obj1.add("html", element1
out.write(obj1.toString());
In this case, your suggested code
var image=result.image;
var html=result.html;
will work.
source
share