Should probably use https://api.drupal.org/api/drupal/includes!common.inc/function/drupal_json_output/7