I have a string like this:
0: array( 'name' => 'john', 'username' => 'foo' ) 1: array( 'name' => 'jack', 'username' => 'foo' )"
how I can encode it in json? I tried with:
$value = array_values($arr);
var_dump($value);
but I get NULL
UPDATE - If I do json_encode($arr); I get:
""\r\n 0: array(\r\n 'name' => 'john',\r\n 'username' => 'foo'\r\n )\r\n 1: array(\r\n 'name' => 'jack',\r\n 'username' => 'foo'\r\n )""
json_encodeI get a bad encoding, check the update question.