我使用JSON屬性,該版本是一個在十一月第二發佈,2009年JSONObject的構造期待豆不映射是在超
當我嘗試使用JSONObject的構造函數,需要一個豆,唯一映射的屬性是在類本身中聲明的屬性,而在超類中聲明的屬性則不是。
我下載了當前版本的JSONObject source,並且檢查了這個版本中沒有發生這個問題。
有誰知道這是我使用的版本中的已知錯誤嗎?另外,有誰知道我在哪裏可以找到此版本的源代碼?
編輯:源代碼的要求
public class Box {
double width;
double height;
double depth;
Box(final double w, final double h, final double d) {
this.width = w;
this.height = h;
this.depth = d;
}
public void getVolume() {
System.out.println("Volume is : " + (width * height * depth));
}
}
public class MatchBox extends Box {
private double weight;
MatchBox(final double w, final double h, final double d, final double m) {
super(w, h, d);
weight = m;
}
}
類的層次結構是類似的東西。使用這個例子,只有weight屬性被映射,寬度,高度和深度都不是。
你可以發佈你的類層次嗎?你想要序列化的所有字段都可見嗎? –
提供@SotiriosDelimanolis示例源代碼。 –
我明白你的意思了。目前的來源是[here](https://github.com/douglascrockford/JSON-java),但我只能看到master分支。 –