Attempt to fix paging on contact summary
[civicrm-core.git] / CRM / Utils / JSON.php
index d771de94e4e6f35ab7b50301bf0fccf991d3ee2c..7ec004714fe3fe1d56f392006509254b66ede7e2 100644 (file)
@@ -46,6 +46,16 @@ class CRM_Utils_JSON {
     CRM_Utils_System::civiExit();
   }
 
+  /**
+   * Test whether the input string is valid JSON.
+   * @param string $str
+   * @return boolean
+   */
+  public static function isValidJSON($str) {
+    json_decode($str);
+    return json_last_error() == JSON_ERROR_NONE;
+  }
+
   /**
    * Do not use this function. See CRM-16353.
    * @deprecated