-3

I want to convert an array of objects to JSON encoding, but how it is possible to encode PHP array into JSON array.

  • 1
    Do 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 Answers1

1

if you want to convert php array into json use:

json_encode($array);

json_encode

for decode

json_decode($array);

json_decode

Emtiaz Zahid
  • 2,645
  • 2
  • 19
  • 35