***Note from Migration:***
Original Title was: Allow to receive JSON format parameter through FMEServer.runDataDownload function
I noticed that FME removes every double quotation from a parameter value formatted in JSON if it was passed via the JavaScript API FMEServer.runDataDownload function.
This is a simplified workspace: fme-server-json-parameter.fmw (FME 2017.1.2.1)

If you run it from the FME Server Web UI, the JSON parameter will be preserved correctly. Good.

However, if you run the workspace from an external web application with the API function, FME will removes every double quotation from the JSON parameter, and therefore it cannot be parsed as a valid JSON document. e.g.
<!DOCTYPE html>
<html>
<head><title>test</title></head>
<body onload="onBodyLoad();">
<div id="result"></div>
<script type="text/javascript" src="http://api.fmeserver.com/js/v1.1/FMEServer.js"></script>
<script type="text/javascript">
function onBodyLoad() {
var server = 'https://xxxxxxxxxxxxxxxx.fmecloud.com';
var token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
FMEServer.init({server:server, token:token});
var jsonParams = {
'param1' : "A",
'param2' : "B",
'param3' : "C",
};
var repository = 'Tests';
var workspace = 'fme-server-json-parameter.fmw';
var parameters = 'JOB_PARAMS=' + JSON.stringify(jsonParams);
FMEServer.runDataDownload(repository, workspace, parameters, function (obj) {
var res = obj.serviceResponse;
if (res.statusInfo.status == 'success') {
document.getElementById('result').innerHTML
= '<p><a href="' + res.url + '">download</a></p>';
}
else {
alert('failure.');
}
});
}
</script>
</body></html>
Log:

Is there a way to preserve a JSON parameter correctly in use of the API function?


