0

I got JSON like this:

$json = '{"message":"{\"Code\":\"402\",\"Message\":\"Failed register new customer\",\"result\":\"Customer Name Already Exisist, \\r\\nSilakan Hubungi IT Untuk Proses Selanjutnya.\"}"}';

I decode this JSON like this:

$msg = json_encode(json_decode($json,true)['message']);

and the result is:

"{\"Code\":\"402\",\"Message\":\"Failed register new customer\",\"result\":\"Customer Name Already Exisist, \r\nSilakan Hubungi IT Untuk Proses Selanjutnya.\"}"

Now, I'd like to decode it again to get the Code and result.

    $new_json = json_decode($msg,true);
    
    echo $new_json->Code;

It give me Message: Trying to get property 'Code' of non-object

How do I get the Code and result?

Shota
  • 515
  • 3
  • 18

0 Answers0