Add helper fn for json_encode + exit
authorColeman Watts <coleman@civicrm.org>
Sun, 24 Aug 2014 15:20:35 +0000 (16:20 +0100)
committerColeman Watts <coleman@civicrm.org>
Sun, 24 Aug 2014 15:20:35 +0000 (16:20 +0100)
CRM/Utils/JSON.php

index e55663698162c03e7f607fc3c0cb668663ab79d9..00287a5eaab62c25176b42a434b76782f3ca6684 100644 (file)
  */
 class CRM_Utils_JSON {
 
+  /**
+   * Output json to the client
+   * @param mixed $input
+   */
+  static function output($input) {
+    header('Content-Type: application/json');
+    echo json_encode($input);
+    CRM_Utils_System::civiExit();
+  }
+
   /**
    * Function to create JSON object
+   * @deprecated
    *
    * @param  array  $params     associated array, that needs to be
    *                            converted to JSON array