I have some data stored in Java elements and I need to return it in a given format - JSONObject. While my implementation works fine, I\'m still getting a warning message fro
You could create a map object and then do an explicit cast to JSONObject
Map obj = new HashMap();
obj.put("id",way.getId());
JSONObject jsonObj = (JSONObject) obj;
But note that this will restrict you only include "Strings" in your JSON. and you will see compile errors if you put another data structure. Say an array.