Replace null in jsonencoded array

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
hazze
New php-forum User
New php-forum User
Posts: 1
Joined: Thu Apr 11, 2019 7:48 am

Thu Apr 11, 2019 7:50 am

Hi i have an json Array : echo json_encode($resultArray) but i want to replace "null" with " ", and i can not get i work?

User avatar
hyper
php-forum Fan User
php-forum Fan User
Posts: 834
Joined: Mon Feb 22, 2016 5:52 pm

Thu Apr 11, 2019 9:53 am

Is there a reason why you want to convert nulls after you have converted it to Json?

It would help us to help you if you posted some code in code blocks: </> button on the editor.

chorn
php-forum Fan User
php-forum Fan User
Posts: 600
Joined: Fri Apr 01, 2016 2:18 am

Thu Apr 11, 2019 10:44 pm

you can just array_walk() or array_walk_recursive() over the array to change certain values.

Post Reply