Sorry I'm very new to parse JSON in java.
I've written a loop that picks 5 cards from a deck of 52 cards (see below). After the cards have been picked i want to validate there is still 52 cards.
On the API it confirms how many cards are remaining but i can't seem to find a value which tells me how many cards have been picked.
https://deckofcardsapi.com/api/deck/new/draw/?count=3
- I've began to write the code below to retrieve the data of how many cards are remaining but it doesn't seem to work.
JSONObject obj = new JSONObject("");
String pageName = obj.getJSONObject("Remaining").getString("Value");
System.out.println("remaining + value");
Below is the JSON to be parsed
{"remaining": 49, "deck_id": "nzzp9cwqokp6", "cards": [{"code": "AS", "images": {"png": "https://deckofcardsapi.com/static/img/AS.png", "svg": "https://deckofcardsapi.com/static/img/AS.svg"}, "value": "ACE", "image": "https://deckofcardsapi.com/static/img/AS.png", "suit": "SPADES"}, {"code": "2S", "images": {"png": "https://deckofcardsapi.com/static/img/2S.png", "svg": "https://deckofcardsapi.com/static/img/2S.svg"}, "value": "2", "image": "https://deckofcardsapi.com/static/img/2S.png", "suit": "SPADES"}, {"code": "6H", "images": {"png": "https://deckofcardsapi.com/static/img/6H.png", "svg": "https://deckofcardsapi.com/static/img/6H.svg"}, "value": "6", "image": "https://deckofcardsapi.com/static/img/6H.png", "suit": "HEARTS"}], "success": true}
-
int counter = 5;
for(int i = 1; i <= counter; i++) { //5 inclusive otherwise use <
String uriString = "https://deckofcardsapi.com/api/deck/new/draw/?count="+i;
System.out.println(i);

System.out.println("remaining + value");toSystem.out.println("remaining " + pageName);?