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

    Map<String,Object> jsonObj = new HashMap<>();
    BigDecimal bd = new BigDecimal("12345.67890");
    jsonObj.put("x", bd);
    String json = JSONUtil.toJSON(jsonObj);
    validateJSON(json);
    assertThat(json, is("{\"x\":12345.67890}"));
    bd = new BigDecimal("9007199254740993");
    jsonObj.put("x", bd);
    JSONConfig cfg = new JSONConfig();
    cfg.setPreciseNumbers(false);
    json = JSONUtil.toJSON(jsonObj, cfg);
    assertThat(json, is("{\"x\":9007199254740993}"));
    cfg.setPreciseNumbers(true);
    json = JSONUtil.toJSON(jsonObj, cfg);
    assertThat(json, is("{\"x\":\"9007199254740993\"}"));
}