Use `OC_JSON::encodedPrint()`. `OCP` is for apps.