Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Extract JSON Value?? Undefined?

ASOFred
Tera Contributor

Hi I'm trying to get the value in a JSON response. Need some assistance. Im writing a script in flow designer.

Need the value from Out_ComboLock in the OutputArguments. Thanks in advance.

 

{
  "@odata.context": "https://cloud.uipath.com/xxxxxx/xxxxx/orchestrator_/odata/$metadata#Jobs/$entity",
  "Key": "6501ef0e-2bd9-48ef-a107-6xxxxxxxxx",
  "StartTime": "2024-03-14T22:35:12.23Z",
  "EndTime": "2024-03-14T22:35:18.38Z",
  "State": "Successful",
  "JobPriority": "Normal",
  "SpecificPriorityValue": 45,
  "ResourceOverwrites": null,
  "Source": "Manual",
  "SourceType": "Manual",
  "BatchExecutionKey": "ed68f774-9b74-4592-xxxxxxxx",
  "Info": "Job completed",
  "CreationTime": "2024-03-14T22:35:11.673Z",
  "StartingScheduleId": null,
  "ReleaseName": "xxxxxxx",
  "Type": "Unattended",
  "InputArguments": "{\"In_Str_Customer_Name\":\"Wally woodse\",\"In_Str_Phone_Number\":\"+1 305-505-4494\",\"In_Str_SEID\":\"84848\",\"In_Str_AssignedPOD\":\"Yes\",\"In_Str_Device_Type\":\"Laptop\",\"In_Str_Lock_Type\":\"HP\",\"In_Str_SerialNumber\":\"17040100D\"}",
  "OutputArguments": "{\"Out_ComboLock\":6789.0,\"Out_Str_SysID\":\"51deccc097c58610fdaxxxxx\"}",
  "HostMachineName": "DESKTOP-6xxxx",
  "HasMediaRecorded": false,
  "HasVideoRecorded": false,
  "PersistenceId": null,
  "ResumeVersion": null,
  "StopStrategy": null,
  "RuntimeType": "Unattended",
  "RequiresUserInteraction": true,
  "ReleaseVersionId": 26xxxxxx,
  "EntryPointPath": "Main.xaml",
  "OrganizationUnitId": 52xxxxxx,
  "OrganizationUnitFullyQualifiedName": null,
  "Reference": "",
  "ProcessType": "Process",
  "ProfilingOptions": null,
  "ResumeOnSameContext": false,
  "LocalSystemAccount": "ELECT",
  "OrchestratorUserIdentity": "xxxxxxx",
  "RemoteControlAccess": "None",
  "StartingTriggerId": null,
  "MaxExpectedRunningTimeSeconds": null,
  "ServerlessJobType": null,
  "ResumeTime": null,
  "LastModificationTime": "2024-03-14T22:35:18.38Z",
  "ProjectKey": "f3648be0-8e7c-4xxxxxxxxx",
  "ParentOperationId": null,
  "Id": 332xxxxxxxx
}

1 ACCEPTED SOLUTION

Amit Pandey
Mega Sage

Hi @ASOFred 

 

Please try this-

var jsonObject = JSON.parse(jsonResponse);
var outputArguments = JSON.parse(jsonObject.OutputArguments);
var outComboLock = outputArguments.Out_ComboLock;
gs.info(outComboLock); 

Regards,

Amit

View solution in original post

4 REPLIES 4

Amit Pandey
Mega Sage

Hi @ASOFred 

 

Please try this-

var jsonObject = JSON.parse(jsonResponse);
var outputArguments = JSON.parse(jsonObject.OutputArguments);
var outComboLock = outputArguments.Out_ComboLock;
gs.info(outComboLock); 

Regards,

Amit

Hi @ASOFred,

 

Since you are using the Flow designer, have you considered creating a custom action for parsing JSON?

https://docs.servicenow.com/bundle/tokyo-application-development/page/administer/flow-designer/refer...

 

Cheers

Close it. Turned out to be.

var jobDataObject = JSON.parse(jobResponseData);

var outputArguments = JSON.parse(jobDataObject.OutputArguments);

var outComboLock = outputArguments["Out_ComboLock"];

Hi @ASOFred 

 

Thanks for confirmation! Can you mark my answer helpful and correct for the interest of community, please.

 

Regards,

Amit