-2
に変更されます。 でも、私は正確な値を取得する方法をマッピングした後、同じ文字列値は、自動的に文字列値が自動的に二重値に変更されたオブジェクトを解析した後、二重値
JSONObject elementInfo = obj.getElementInfo();
System.out.println("get elementInfo ---> "+elementInfo.get("info"));
//mapping
ArrayList<Object> getEle = gson.fromJson((String) elementInfo.get("info"), ArrayList.class);
System.out.println("After mapping getele----> "+getEle);
結果
get elementInfo ---> [{noOfBins=2, indices=[1, 3]}, {noOfBins=3, indices=[2]}]
After mapping getele----> [{noOfBins=2.0, indices=[1.0, 3.0]}, {noOfBins=3.0, indices=[2.0]}]
ための任意の回避策? JSONで
[{noOfBins=2, indices=[1, 3]}, {noOfBins=3, indices=[2]}]
私はあなた 'elementInfo' JSONで任意の文字列が表示されません。 JSONのStringは引用符なしで、これは数値で、 '「2」や' ' '2''のようなものです – AxelH