Question the UiPath string value gurus out there. I’m working on getting JavaScript Inject output working so I can use Deserialize on it.
When I read in a JSON blob with the Read Text File activity and look at the value in the Studio debugger it looks like what is shown in the “Local Value” window in the image below:
The above is just example text purely looking to see how it looks and work with Deserialize. When I push this through Deserialize it works fine.
Side question, what does the @ sign in the Local Value window indicate/mean ?
When I use a small blob of JS code using the JS Inject activty which calls a URL and returns the result back into my workflow (which is JSON itself), the JSON string value looks this in the Studio Debugger:
Looking like this, Deserialize fails
My question … Is there something I could be doing in the JS code itself to help make the returned value from the JS injection work or some quick replace or convert step in UiPath after the JS Inject activity to make this value looks-like and behave appropriately with the Deserilize activity ?
The JS code itself is simply this currently:
function(element,input)
{
var theUrl = 'Encoded URL to hit';
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", theUrl, false ); // false for synchronous request
xmlHttp.send( null );
var jsonObj = JSON.parse(xmlHttp.responseText);
//return xmlHttp.responseText;
return JSON.stringify(jsonObj);
}