Vous pouvez utiliser my json library. Il prend en charge le marshalling et unmarshalling aux classes (avec quelques restrictions) et l'analyse.
Marshalling:
Knight knight = new Knight();
knight.name = "Lancelot";
knight.weapon = new Weapon();
knight.weapon.metal = "true silver";
knight.weapon.name = "piercer";
knight.rank = 2;
knight.titles = new String[] { "noble", "round table member" };
Land goldshire = new Land();
goldshire.name = "GoldShire";
goldshire.surface = 45532.3;
Land direwood = new Land();
direwood.name = "Direwood";
direwood.surface = 472;
knight.lands = new Land[] { goldshire, direwood };
System.out.println("Test 1 : marshall simple class:");
String generated = JsonFactory.marshal(knight).toString();
unmarshalling:
Knight knight = (Knight) JsonFactory.unmarshal(new FileTools().readFile("UnmarshallingTest1.json"), Knight.class);
http://www.json.org/java/ – nattyddubbs
Je recommande vraiment vous mettre à jour vers une nouvelle version Java. Un grand avantage de Java est la rétrocompatibilité. – Eich