I am trying to make an Ext direct call using a script on the server side. Why is this not compliant json?

You're trying to decode an invalid JSON String: <html><body><textarea>{"tid": 1, "action": "api", "type": "rpc", "method": "foo", "result": "hello world"}</textarea></body></html>

Based on this excerpt from the documentation at

I tried wrapping quotes with slashes and got the same result.

This response will be JSON encoded. The router can send back multiple transactions within a single response enclosed in an array. If the request was a form post and it was an upload the response will be sent back as a valid html document with the following content:

<html><body><textarea>{YOUR JSON RESPONSE HERE}</textarea></body></html> " must be back-slashed because the textarea will convert them to actual quotes. Therefore you must do a regular expression (//, \)