public static function objectsToJson($objectArray)
    {
        $tmp = [];
        foreach ($objectArray as $key => $item){
            if (is_object($item) || is_array($item)) {
                $item = json_encode($item);
            }
            $tmp[$key] = $item;
        }
        return $tmp;
    }
public static function objectsToJson($objectArray)
    {
        $tmp = [];
        foreach ($objectArray as $key => $item){
            if (is_object($item) || is_array($item)) {
                $item = json_encode($item);
            }
            $tmp[$key] = $item;
        }
        return $tmp;
    }
public static function objectsToJson ( $ objectArray ) { $ tmp = [ ] ; foreach ( $ objectArray as $ key => $ item ) { if ( is_object ( $ item ) || is_array ( $ item ) ) { $ item = json_encode ( $ item ) ; } $ tmp [ $ key ] = $ item ; } return $ tmp ; }
encode a list of object or arrays as json.

@param  array $objectArray list of data
@return array encoded data
encode a list of object or arrays as json .