From a63c07d9d932aa02f000e50ccd1400a117d6be97 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sun, 24 Aug 2014 16:20:35 +0100 Subject: [PATCH] Add helper fn for json_encode + exit --- CRM/Utils/JSON.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CRM/Utils/JSON.php b/CRM/Utils/JSON.php index e556636981..00287a5eaa 100644 --- a/CRM/Utils/JSON.php +++ b/CRM/Utils/JSON.php @@ -38,8 +38,19 @@ */ 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 -- 2.25.1