Server-side script appears to be mangling data in 'patch' api call

I am attempting to use a server-side script (tried in both PHP and v8js) to call another REST API (through DreamFactory) to update a record in a MongoDB database, but it keeps coming up with an error (invalid JSON number). If I get the script to return the JSON that it should be sending using platform.api.patch, call the script from Postman, copy the result as the data to a PATCH request in Postman and run that, it works perfectly so the data as it is in the script doesn’t seem to be the issue, but something seems to occur in the platform.api.patch call between the script and the other REST API which makes the data unusable.

Has anyone seen anything similar, or have any ideas on how to fix it?

It turns out that I had forgotten to encode the json when putting it in the PATCH request, and as I was putting it into the ‘event’ resource to return it, it was being encoded properly later on.