defines the functions exported by the module More...
Functions | |
string | makeJSONString (any $data,*string $encoding) |
Serializes qore data into a JSON string, without any line breaks. | |
string | makeFormattedJSONString (any $data,*string $encoding) |
Serializes qore data into a JSON string, formatted with line breaks for easier readability. | |
any | parseJSON (string $json_string) |
Parses a JSON string and returns the corresponding Qore data structure. | |
nothing | parseJSON () |
This is a variant that is basically a noop, included for backwards-compatibility for functions that ignored type errors in the calling parameters. | |
string | makeJSONRPCRequestString (string $method_name, any $version, any $id, any $request_msg) |
Creates a JSON-RPC request string from the parameters passed, without any line breaks. | |
string | makeFormattedJSONRPCRequestString (string $method_name, any $version, any $id, any $request_msg) |
Creates a JSON-RPC request string from the parameters passed, formatted with line breaks for easier readability. | |
string | makeJSONRPCResponseString (any $version, any $id, any $response_msg) |
Creates a JSON-RPC response string from the parameters passed, without any line breaks. | |
string | makeFormattedJSONRPCResponseString (any $version, any $id, any $response_msg) |
Creates a JSON-RPC response string from the parameters passed, formatted with line breaks for easier readability. | |
string | makeJSONRPCErrorString (any $version, any $id, any $error_msg) |
Creates a generic JSON-RPC error response string from the parameters passed, without any line breaks. | |
string | makeFormattedJSONRPCErrorString (any $version, any $id, any $error_msg) |
Creates a generic JSON-RPC error response string from the parameters passed, formatted with line breaks for easier readability. | |
string | makeJSONRPC11ErrorString (softint $code, string $error, any $id, any $error_msg) |
Creates a JSON-RPC 1.1 error response string from the parameters passed, without any line breaks. | |
string | makeFormattedJSONRPC11ErrorString (softint $code, string $error, any $id, any $error_msg) |
Creates a JSON-RPC 1.1 error response string from the parameters passed, formatted with line breaks for easier readability. |
defines the functions exported by the module
string makeFormattedJSONRPC11ErrorString | ( | softint | $code, |
string | $error, | ||
any | $id, | ||
any | $error_msg | ||
) |
Creates a JSON-RPC 1.1 error response string from the parameters passed, formatted with line breaks for easier readability.
$code | the error code to return |
$error | a string error message |
$id | the ID of the call |
$error_msg | the parameters for the error response message/message payload |
MAKE-JSONRPC11-ERROR-STRING-ERROR | the error code is not between 100-999 or empty error message string |
JSON-SERIALIZATION-ERROR | cannot serialize value passed (ex: binary, object) |
my string $json = makeFormattedJSONRPC11ErrorString(200, $msg, $id, $error);
string makeFormattedJSONRPCErrorString | ( | any | $version, |
any | $id, | ||
any | $error_msg | ||
) |
Creates a generic JSON-RPC error response string from the parameters passed, formatted with line breaks for easier readability.
$version | the JSON-RPC version to include in the call |
$id | the ID of the call |
$error_msg | the parameters for the error response message/message payload |
JSON-SERIALIZATION-ERROR | cannot serialize value passed (ex: binary, object) |
my string $json = makeFormattedJSONRPCErrorString("1.0", $id, $error);
string makeFormattedJSONRPCRequestString | ( | string | $method_name, |
any | $version, | ||
any | $id, | ||
any | $request_msg | ||
) |
Creates a JSON-RPC request string from the parameters passed, formatted with line breaks for easier readability.
To follow JSON-RPC specifications, the generated string will always be in UTF-8 encoding
$method_name | the name of the JSON-RPC method to call |
$version | the JSON-RPC version to include in the call |
$id | the ID of the call |
$request_msg | the parameters for the message/message payload |
JSON-SERIALIZATION-ERROR | cannot serialize value passed (ex: binary, object) |
my string $json = makeFormattedJSONRPCRequestString("omq.system.help", "1.0", $id, $msg);
string makeFormattedJSONRPCResponseString | ( | any | $version, |
any | $id, | ||
any | $response_msg | ||
) |
Creates a JSON-RPC response string from the parameters passed, formatted with line breaks for easier readability.
$version | the JSON-RPC version to include in the call |
$id | the ID of the call |
$response_msg | the parameters for the message/message payload |
JSON-SERIALIZATION-ERROR | cannot serialize value passed (ex: binary, object) |
my string $json = makeFormattedJSONRPCResponseString("1.0", $id, $msg);
string makeFormattedJSONString | ( | any | $data, |
*string | $encoding | ||
) |
Serializes qore data into a JSON string, formatted with line breaks for easier readability.
By default the string produced will be in UTF-8 encoding, but this can be overridden by the second argument
$data | the data to serialize to a JSON string |
$encoding | an optional output encoding for the resulting JSON string; if this argument is not passed, then the UTF-8 encoding is used by default |
JSON-SERIALIZATION-ERROR | cannot serialize value passed (ex: binary, object) |
my string $json = makeFormattedJSONString($data);
string makeJSONRPC11ErrorString | ( | softint | $code, |
string | $error, | ||
any | $id, | ||
any | $error_msg | ||
) |
Creates a JSON-RPC 1.1 error response string from the parameters passed, without any line breaks.
$code | the error code to return |
$error | a string error message |
$id | the ID of the call |
$error_msg | the parameters for the error response message/message payload |
MAKE-JSONRPC11-ERROR-STRING-ERROR | the error code is not between 100-999 or empty error message string |
JSON-SERIALIZATION-ERROR | cannot serialize value passed (ex: binary, object) |
my string $json = makeJSONRPC11ErrorString(200, $msg, $id, $error);
string makeJSONRPCErrorString | ( | any | $version, |
any | $id, | ||
any | $error_msg | ||
) |
Creates a generic JSON-RPC error response string from the parameters passed, without any line breaks.
$version | the JSON-RPC version to include in the call |
$id | the ID of the call |
$error_msg | the parameters for the error response message/message payload |
JSON-SERIALIZATION-ERROR | cannot serialize value passed (ex: binary, object) |
my string $json = makeJSONRPCErrorString("1.0", $id, $error);
string makeJSONRPCRequestString | ( | string | $method_name, |
any | $version, | ||
any | $id, | ||
any | $request_msg | ||
) |
Creates a JSON-RPC request string from the parameters passed, without any line breaks.
To follow JSON-RPC specifications, the generated string will always be in UTF-8 encoding
$method_name | the name of the JSON-RPC method to call |
$version | the JSON-RPC version to include in the call |
$id | the ID of the call |
$request_msg | the parameters for the message/message payload |
JSON-SERIALIZATION-ERROR | cannot serialize value passed (ex: binary, object) |
my string $json = makeJSONRPCRequestString("omq.system.help", "1.0", $id, $msg);
string makeJSONRPCResponseString | ( | any | $version, |
any | $id, | ||
any | $response_msg | ||
) |
Creates a JSON-RPC response string from the parameters passed, without any line breaks.
$version | the JSON-RPC version to include in the call |
$id | the ID of the call |
$response_msg | the parameters for the message/message payload |
JSON-SERIALIZATION-ERROR | cannot serialize value passed (ex: binary, object) |
my string $json = makeJSONRPCResponseString("1.0", $id, $msg);
string makeJSONString | ( | any | $data, |
*string | $encoding | ||
) |
Serializes qore data into a JSON string, without any line breaks.
By default the string produced will be in UTF-8 encoding, but this can be overridden by the second argument
$data | the data to serialize to a JSON string |
$encoding | an optional output encoding for the resulting JSON string; if this argument is not passed, then the UTF-8 encoding is used by default |
JSON-SERIALIZATION-ERROR | cannot serialize value passed (ex: binary, object) |
my string $json = makeJSONString($data);
any parseJSON | ( | string | $json_string ) |
Parses a JSON string and returns the corresponding Qore data structure.
$json_string | the JSON string to parse |
JSON-PARSE-ERROR | syntax error parsing JSON string |
my any $data = parseJSONValue($json);
nothing parseJSON | ( | ) |
This is a variant that is basically a noop, included for backwards-compatibility for functions that ignored type errors in the calling parameters.