Utility for converting Entity to JSONObject