there’s no PHP code (so nothing to answer on your missing argument) and there is just one response and there is no code trying to combine anything. and yes, concatenating jsons will not produce a valid json, but you are still not specific at what your ‘combine’ should do with two json strings.
What i want to do is combine these two responses into one object i can then query. It works if i just try to read either of the 2 responses but as soon as i combine them i get the errors.
as the results may be 2 JSON strings i assume you first want to convert them into asociative arrays (= with keys) via json_decode() (provide second parameter) and then merge existing keys of both? therefore you can use array_merge() on both arrays and type cast it back to an object.
// Convert JSONs to arrays
$array1 = json_decode($json1, true);
$array2 = json_decode($json2, true);
// Works as long as the arrays does not have equal keys in them
$combinedArray = array_merge($array1, $array2);
// Alternative way. Also works as long as the arrays does not have equal keys in them
$combinedArray = $array1+$array2;
// Convert back to valid json
$resultJSON = json_encode($combinedArray);
echo $resultJSON;
If the arrays do have equal string keys then you could write your own combine function to merge the arrays so you do not lose data in the process. This because array_merge will overwrite and replace the values if there is equal string keys in the arrays.