-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Description
Can you please help me sort this out?
I keep getting a error massage.
import org.json.JSONArray;
import org.json.JSONObject;
public class Main {
public static void main(String[] args) {
String jsonStr = "{ \"Number1\" : 123.456 , \"Number2\" : [ 223.456 , 323.456 ] }";
JSONObject json = new JSONObject(jsonStr);
Float number1 = json.getFloat("Number1");
System.out.println(json);
JSONArray jsonArr = json.getJSONArray("Number2");
System.out.println(jsonArr);
System.out.println(number1);
Float number2 = jsonArr.getFloat(0);
System.out.println(number2);
Float number3 = jsonArr.getFloat(1);
System.out.println(number3);
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels