@Test
public void testComplex() throws ScriptException, NoSuchMethodException
{

    Map<String,Object> jsonObj = new LinkedHashMap<>();
    jsonObj.put("a",1);
    jsonObj.put("b","x");
    String[] ia = {"1","2","3"};
    List<String> il = Arrays.asList(ia);
    jsonObj.put("c",ia);
    jsonObj.put("d",il);
    Object[] objs = new Object[3];
    objs[0] = null;
    objs[1] = (JSONAble)(jsonConfig, json) ->
                  {
                      JSONConfig cfg = jsonConfig == null ? new JSONConfig() : jsonConfig;
                      Map<String,Object> stuff = new LinkedHashMap<>();
                      stuff.put("a", 0);
                      stuff.put("b", 2);
                      int[] ar = {1, 2, 3};
                      stuff.put("x", ar);
                      stuff.put("t", null);
                      JSONUtil.toJSON(stuff, cfg, json);
                 };
    objs[2] = il;
    jsonObj.put("e", objs);
    JSONConfig cfg = new JSONConfig();
    String json = JSONUtil.toJSON(jsonObj, cfg);
    validateJSON(json);
    assertThat(json, is("{\"a\":1,\"b\":\"x\",\"c\":[\"1\",\"2\",\"3\"],\"d\":[\"1\",\"2\",\"3\"],\"e\":[null,{\"a\":0,\"b\":2,\"x\":[1,2,3],\"t\":null},[\"1\",\"2\",\"3\"]]}"));
}