mirror of
https://github.com/fankes/JSON-java-compat.git
synced 2025-09-08 11:34:43 +08:00
Fixed incorrect cast getting float from array
Added test for getting float from array
This commit is contained in:
@@ -326,7 +326,7 @@ public class JSONArray implements Iterable<Object> {
|
||||
public float getFloat(int index) throws JSONException {
|
||||
final Object object = this.get(index);
|
||||
if(object instanceof Number) {
|
||||
return ((Float)object).floatValue();
|
||||
return ((Number)object).floatValue();
|
||||
}
|
||||
try {
|
||||
return Float.parseFloat(object.toString());
|
||||
|
Reference in New Issue
Block a user