You should use `\OCP\JSON::EncodedPrint($contacts);` or `\OCP\JSON::success($contacts);`