4

I'm using JCAPS 5.1.3 and only have Java 1.4 and need to handle with Json data. Unfortunately all libraries I've found use Java 1.5 and above. I just found lots of new implementations in this thread here, but which one works with 1.4.

Is there a stable and simple version to use with Java 1.4?

Community
  • 1
  • 1
rosi
  • 41
  • 1
  • 2

3 Answers3

2

Xstream 1.2.2 supports Java 1.4. It's the only library I've found that supports Java 1.4. It definitely has its warts though.

MatheusOl
  • 10,870
  • 3
  • 30
  • 28
drt
  • 888
  • 1
  • 8
  • 19
1

An alternative is to use Retroweaver to make the jar compatible with Java 1.4:

http://retroweaver.sourceforge.net

Emmanuel Bourg
  • 9,601
  • 3
  • 48
  • 76
1

You can use my json library. It supports marshalling and unmarshalling to classes (with some restrictions) and parsing.

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);
Mariano LEANCE
  • 1,036
  • 13
  • 10