" it's clunky and chunky and verbose and ... and ... "
Map<String, Object> data = ImmutableMap.<String, Object>builder()
.put("key1", "data1")
.put("key2", 2)
.put("key3", false)
.put("nestedKey1", singletonMap("processed", false))
.put("nestedKey2", ImmutableMap.of(
"one", "un",
"two", "deux",
"three", "trois"))
.put("nestedKey3", asList(2, 3, 5, 7, 11, 13, 17, 19))
.build();was the reaction of a JS colleague at the sight of this
String jsonString = "{"
+ "`key1` : `data1`,"
+ "`key2` : 2,"
+ "`key3` : false,"
+ "`nestedKey1` : { `processed`: false },"
+ "`nestedKey2` : { `one` : `un`, `two` : `deux` },"
+ "`nestedKey3` : [ 2, 3, 5, 7, 11, 13, 17, 19 ]"
+ "}".replaceAll("`", "\"");