PHP print_r works, but json_encode returns empty [duplicate] PHP print_r works, but json_encode returns empty [duplicate] sql sql

PHP print_r works, but json_encode returns empty [duplicate]


json_encode only supports UTF-8 encoded strings, so you'll have to encode your order_item_name values using either htmlentities or utf8_encode

foreach($array1 as &$v) {  $v['order_item_name'] = utf8_encode($v['order_item_name']);}print json_encode($array1);

For more info see problems with german umlauts in php json_encode