List<X> xs = new ArrayList<X>();
xs.add(new X("0"));
xs.add(new X("1"));
xs.add(new X("2"));
ArrayNode array = Util.toJSONArray(xs);
ArrayNode safes = Util.toSafeJSONArray(xs);
assertThat(array.size(), is(3));
assertThat(array.get(0).get("value").asText(), is("0"));
assertThat(array.get(1).get("value").asText(), is("1"));
assertThat(array.get(2).get("value").asText(), is("2"));
assertThat(safes.size(), is(3));
assertThat(safes.get(0).get("safe").asText(), is("0"));
assertThat(safes.get(1).get("safe").asText(), is("1"));
assertThat(safes.get(2).get("safe").asText(), is("2"));
}