<?php $responseOne = '{ "success": true, "msg": "", "obj": [ { "id": 1, "remark": "D" }, { "id": 159, "remark": "mssdss" } ] }'; $responseTwo = '{ "success": true, "msg": "", "obj": [ { "id": 14, "remark": "tttt" }, { "id": 56, "remark": "ok" } ] }'; $mergedResponse = json_encode( array_merge( json_decode($responseOne, true)['obj'], json_decode($responseTwo, true)['obj'] ) ); // Print the merged JSON response var_dump($mergedResponse);
You have javascript disabled. You will not be able to edit any code.