Running XMLHttpRequest with JSON
the below data is brought from exchangeratesapi.io web-site

JSON.parse(httpRequest.responseText).rates.ILS;
when the open command is

httpRequest.open('GET', 'https://api.exchangeratesapi.io/latest?base=USD');
In the specific api rates.ILS will return the ILS rate
The basic query of latest rate will return this:

{
"rates": {
    "BGN": 1.7225647349,
    "HRK": 6.5332041571,
    "ILS": 3.6087722389,
    "CHF": 0.998590805,
    "PHP": 52.8818037696,
},
"date": "2019-03-20",
"base": "USD"
}
so....

.date           will return     2019-03-20
.base           will return     USD
.rates.ILS      will return     3.6087722389
.rates.CHF      will return     0.998590805
another sample of json collection of data, for images
Random Pets Viewer
The sample show the usage of 'onLoad' event and view of the result to an image

//this sample code needs to be completed to work with all types of pets
//currently working only with Dogs 
var webAddr = 'https://dog.ceo/api/breeds/image/random';
function changePet(){
    var selectedPet = document.querySelector('#pets').value;        //select the pet
    switch(selectedPet) {
        case 'Dogs':
            webAddr = 'https://dog.ceo/api/breeds/image/random';    //set the url of the 'open' action
        case 'Cats':
            webAddr = 'https://aws.random.cat/meow';
        case 'Foxes':
        webAddr = 'http://randomfox.ca/floof';
    }
}
function makeRequest() {
    var httpRequest = new XMLHttpRequest();
    httpRequest.responseType = 'json';
        httpRequest.onload = function() {                       //using the onLoad event
        if (httpRequest.status === 200){
            console.log(httpRequest.response);
            var json = httpRequest.response;
            document.querySelector('.image').src = httpRequest.response.message;        //message is for 'dogs'
        } else {
            alert('There was a problem with the request. \r\n The Page has returned error number: ' + httpRequest.status)
        }
    };
    httpRequest.open('GET', webAddr);
    httpRequest.send();
}
//this sample code needs to be completed to work with all types of pets 
back to main page