tubadc
tubadc

Reputation: 772

PHP json_encode not encoding... why?

I've the following array in a $arrayResult:

array (size=1)
  'Records' => 
    array (size=1498)
      0 => 
        array (size=4)
          'code' => string '9999999' (length=12)
          'nome' => string 'XXXXXXXXX' (length=39)
          'contrato' => string '67971' (length=5)
          'status' => string 'A' (length=1)
      1 => 
        array (size=4)
          'code' => string '777777777' (length=12)
          'nome' => string 'WWwwwwwww' (length=40)
          'contrato' => string '67725' (length=5)
          'status' => string 'C' (length=1)

    .... (other results with the same pattern)

    $resultArray = $view->getAllAccounts();
    $final['Records'] = $resultArray;
    echo json_encode($final, true);

when I get the array and use the json_encode nothing happens.

Upvotes: 0

Views: 524

Answers (1)

user594138
user594138

Reputation:

Regardless of the data-structures and code you wrote so far, if you encounter unexpected behaviour using json_decode and json_encode, use json_last_error and/or json_last_error_msg to see what happened.

Upvotes: 4

Related Questions