diff --git a/cmpUtil.php b/cmpUtil.php index 362a5ab..5272429 100644 --- a/cmpUtil.php +++ b/cmpUtil.php @@ -130,6 +130,19 @@ return null; } + function encodeJSONCompact($obj) { + $text = json_encode($obj, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); + + $err = json_last_error(); + + if($err === JSON_ERROR_NONE) + return $text; + + $this->errorJSON($err); + + return null; + } + function readFile($file) { return @file_get_contents( $file , // string