I'm attempting to fetch an API that has 2 variables I need out of hundreds. How do I get just these 2 variables and assign them to variables in a function?
When I do
fetch( " https://genericAPI.com" )
.then( response => response.json() )
.then( json => console.log( json ) );
The log is full of all these variables I mentioned about, but I don't know how to single the 2 I need out and assign them to other variables. I've done this in java by doing the following
JSONObject myResponse = new JSONObject(response.toString());
String end = myResponse.getString("endAt");
String beg = myResponse.getString("startAt");
I've been looking everywhere for a guide on how to do this, but I think I'm using the incorrect terminology so I can't find an answer
Here's part of what's returned, endAt is one in particular I'm trying to grab
{"endAt": "1533797999000",
"exchangeEndAt": "1534748399000",
"enableFlag": true,
"publicEndAt": "1533949199000",
"distributionStartAt": "1533848400000",
"eventId": 14,
"rankingRewards":...
)