Yaml is a super set (almost) of JSon and much more forgiving. It is much closer to what you have by default.
String s = "{ items: [\n" +
" { id: 1, name: 'test1' }, \n" +
" { id: 2, name: 'test2' }\n" +
"] }";
Map map = (Map) new Yaml().load(s);
System.out.println(map);
prints
{items=[{id=1, name=test1}, {id=2, name=test2}]}
BTW This is how it dumps to Yaml by default.
System.out.println(new Yaml().dump(map));
prints
items:
- {id: 1, name: test1}
- {id: 2, name: test2}
I used snakeyaml. You can also bind the data to class(es)