Skip to content
← Back to Community
How to add data to json
Profile icon
samba0648

I'm trying to add data to a JSON when registration is successful.
But it is showing null, can anyone help me in this.

Voters
Profile icon
aa218
Profile icon
linusss
Profile icon
samba0648
Comments
hotnewtop
Profile icon
WilliamPenrod

You need to properly format your JSON file.
Just add the [ to the beginning of the JSON file and ] to the end.
Then continue to debug from there :)

Profile icon
samba0648

I tried with adding [] in the JSON file. But this time also only null is adding not the actual [email protected]

Profile icon
samba0648

but in the script, I'm using json_encode() function which will convert the array into json object. So I think no need of adding []@WilliamPenrod

Profile icon
WilliamPenrod

@samba0648 I got it to work by adding [] and fixing some logical errors, so im not sure what to tell you. :)

Profile icon
samba0648

Thanks for your concern. I have fixed [email protected]

Profile icon
WilliamPenrod

@samba0648 Glad to hear it!