### Question:
ComplexKey { @JsonValue public JsonNode toJson() { ArrayNode key = mapper.createArrayNode(); for (Object component : components) { if (component == EMPTY_OBJECT) { key.addObject(); } else { key.addPOJO(component); } } return key; } private  ComplexKey(Object[] components); static ComplexKey of(Object... components); static Object emptyObject(); static Object[] emptyArray(); @JsonValue JsonNode toJson();  }### Answer:
@Test public void testToJson() throws Exception { String json = mapper.writeValueAsString(ComplexKey.of(ComplexKey.emptyArray(), Integer.valueOf(2), "fooz", ComplexKey.emptyObject())); assertEquals("[[],2,\"fooz\",{}]", json); }