This is one way to check the difference between two array or json. Make sure the pattern in json / array is similar to one another or else you will see error.
$json1 = file_get_contents('https://yourendpointurlhere.com/json1');
//This is response returned from an endpoint.
$json2 = file_get_contents('https://yourendpointurlhere.com/json2');
//This is response returned from an endpoint.
Here we want to get common name from two file. As array counting starts from 0, the name indexing is 1.
Here is the sample code for the implementation.
You will get array of names in result. Hope that helps