Raghul Rajendran Raghul Rajendran - 1 year ago 104
JSON Question

How to convert object format to json format in php

I'm using

to remove the duplicate values but it returns an object format.

$event = array_unique($array_event);

output as


Excepted output:


Can anyone help with this issue?

Answer Source

You shoud reindex result before json_encode

$event = array_values(array_unique($array_event));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download