Convert { @SuppressWarnings("unchecked") public static String mapsToJson(Collection<Multimap<String, Object>> list) { StringBuilder sb = new StringBuilder(); sb.append('['); for (Object map : list) { if(map instanceof Multimap) { Multimap<String, Object> map0 = (Multimap<String, Object>) map; sb.append(mapToJson(map0)); sb.append(","); } else if(map instanceof Map) { Map<String, Object> map0 = (Map<String, Object>) map; sb.append(mapToJson(map0)); sb.append(","); } else { ((Multimap<String, Object>) map).getClass(); } } sb.setCharAt(sb.length() - 1, ']'); return sb.toString(); } private  Convert(); static List<Multimap<String, Object>> anyJsonToJava(String json); static TObject javaToThrift(Object object); static Multimap<String, Object> jsonToJava(String json); @SuppressWarnings("unchecked") static String mapsToJson(Collection<Multimap<String, Object>> list); static String mapToJson(Map<String, ?> map); static String mapToJson(Multimap<String, Object> map); static String operatorToString(Operator operator); @SuppressWarnings("unchecked") static T possibleThriftToJava(Object tobject); static Object stringToJava(String value); static Operator stringToOperator(String symbol); static String stringToResolvableLinkInstruction(String ccl); @Deprecated static String stringToResolvableLinkSpecification(String key,
            String rawValue); static Object thriftToJava(TObject object); static Object toFunctionOrUnescapedValueIfPossible(Object value);  }
@Test public void testConvertMapsToJson() { List<Multimap<String, Object>> list = Lists.newArrayList(); Multimap<String, Object> a = LinkedHashMultimap.create(); Multimap<String, Object> b = LinkedHashMultimap.create(); Multimap<String, Object> c = LinkedHashMultimap.create(); a.put("a", 1); a.put("b", 2); a.put("c", 3); b.put("a", "a"); b.put("a", 1); b.put("b", "b"); b.put("b", 2); b.put("c", 3); b.put("c", "c"); c.put("a", true); c.put("a", false); c.put("a", 1.1); c.put("b", 3.14); c.put("b", "hello"); c.put("b", "world"); c.put("c", "me"); c.put("c", 0); c.put("c", 4L); list.add(a); list.add(b); list.add(c); Assert.assertEquals( "[{\"a\":1,\"b\":2,\"c\":3},{\"a\":[\"a\",1],\"b\":[\"b\",2],\"c\":[3,\"c\"]},{\"a\":[true,false,\"1.1D\"],\"b\":[\"3.14D\",\"hello\",\"world\"],\"c\":[\"me\",0,4]}]", Convert.mapsToJson(list)); }