I want to convert an array of objects to JSON encoding, but how it is possible to encode PHP array into JSON array.
Asked
Active
Viewed 44 times
-3
-
1Do you have a problem with using `json_encode($your_array)`? – Caleb H. Nov 16 '18 at 05:12
-
Possible duplicate of [Preferred method to store PHP arrays (json\_encode vs serialize)](https://stackoverflow.com/questions/804045/preferred-method-to-store-php-arrays-json-encode-vs-serialize) – Difster Nov 16 '18 at 05:15
-
if you type "encode PHP array into JSON array" into google you get the answer straight away. Why did you bother waiting for us to tell you?? – ADyson Nov 16 '18 at 09:55
1 Answers
1
if you want to convert php array into json use:
json_encode($array);
for decode
json_decode($array);

Emtiaz Zahid
- 2,645
- 2
- 19
- 35

Parveen Suyan
- 26
- 2