Convert null to empty string for json output in PHP

# Technique 1:

array_walk_recursive($YOUR_ARRAY, function (&$item, $key) {
    $item = null === $item ? '' : $item;
});

# Technique 2:

array_walk($YOUR_ARRAY, function(&$item) {
    $item = strval($item);
});