PHP calling function within a class

You can merge this two json objects via array_merge. But you must decode before to a array. You have this inside your example, below as single source function. This should get the merged json object.

A example function, usable for your mix_cat()method.

function mergeToJSON( $obj1, $obj2 ) {

    $json1 = $this->test_cat();
    $json2 = $this->test_cat1();

    if ( $json1 === FALSE || $json2 === FALSE ) {
        return;
    }

    $array1 = json_decode( $json1, TRUE );
    $array2 = json_decode( $json2, TRUE );
    $data = array_merge( $array1, $array2 );

    return json_encode( $data );
}