| | |
| | | } |
| | | |
| | | public String jsonWithCustomType(Object o, String typeName) { |
| | | /* |
| | | StringBuilder sb = new StringBuilder(); |
| | | sb.append("{\""); |
| | | sb.append(typeName); |
| | |
| | | sb.append(gson.toJson(o)); |
| | | sb.append("}"); |
| | | return sb.toString(); |
| | | */ |
| | | Gson gson = new Gson(); |
| | | return embedInCustomType(gson.toJson(o), typeName); |
| | | } |
| | | |
| | | public String embedInCustomType(String jsonStr, String typeName) { |
| | | StringBuilder sb = new StringBuilder(); |
| | | sb.append("{\""); |
| | | sb.append(typeName); |
| | | sb.append("\": "); |
| | | //Gson gson = new Gson(); |
| | | //sb.append(gson.toJson(o)); |
| | | sb.append(jsonStr); |
| | | sb.append("}"); |
| | | return sb.toString(); |
| | | } |
| | | |
| | | } |