The JSON is not valid. (Parameter 'JSONPayload') Error Orchestrator HTTP Request

Hi everyone,
I am trying to start a job with input parameters using Orchestrator HTTP Request activity:

When I pass this code to JSON Payload section

"{startInfo: {ReleaseKey: '-----',Strategy: 'ModernJobsCount',JobPriority: 'Normal',InputArguments: '{strCompany:'---',strURL:'" + strURL +"'}',JobsCount: 1}}"

I get error in Orchestrator:

The JSON is not valid. (Parameter ‘JSONPayload’)

System.ArgumentException: The JSON is not valid. (Parameter ‘JSONPayload’) —> Newtonsoft.Json.JsonReaderException: After parsing a value an unexpected character was encountered: T. Path ‘startInfo.InputArguments’, line 1, position 144. at Newtonsoft.Json.JsonTextReader.ParsePostValue(Boolean ignoreComments)
at Newtonsoft.Json.JsonTextReader.Read()
at Newtonsoft.Json.Linq.JContainer.ReadContentFrom(JsonReader r, JsonLoadSettings settings)
at Newtonsoft.Json.Linq.JContainer.ReadTokenFrom(JsonReader reader, JsonLoadSettings options)
at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)
at Newtonsoft.Json.Linq.JToken.ReadFrom(JsonReader reader, JsonLoadSettings settings)
at Newtonsoft.Json.Linq.JToken.Parse(String json, JsonLoadSettings settings)
at Newtonsoft.Json.Linq.JToken.Parse(String json)
at UiPath.Core.Activities.OrchestratorHttpRequest.ExecuteAsync(IOrchestratorActivitiesClient orchestratorClient, AsyncCodeActivityContext context, CancellationToken ct)
— End of inner exception stack trace —
at UiPath.Core.Activities.TaskExtensions.ThrowIfNeeded(Task task, Boolean suppresThrowException)
at UiPath.Core.Activities.Orchestrator.BaseOrchestratorClientActivity.ThrowIfNeeded(AsyncCodeActivityContext ctx, Task task, Boolean suppresThrowException)
at UiPath.Core.Activities.Orchestrator.BaseOrchestratorClientActivity1.EndExecute(AsyncCodeActivityContext context, IAsyncResult result) at UiPath.Core.Activities.OrchestratorHttpRequest.EndExecute(AsyncCodeActivityContext context, IAsyncResult result) at System.Activities.AsyncCodeActivity1.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
— End of stack trace from previous location —
at UiPath.UIAutomationNext.Activities.NApplicationCard.OnFault(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
at System.Activities.Runtime.FaultCallbackWrapper.Invoke(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
at System.Activities.Runtime.FaultCallbackWrapper.FaultWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

But I exactly do the same with videos below:
UiPath Tutorial | Orchestrator HTTP Request - Start Job using Release Key and Robot ID (youtube.com)
UiPath Orchestrator API Using Orchestrator HTTP Request Activity | Part 6 | Run the Job from Studio (youtube.com)

Can you help me ?

Have you cross-checked within Swagger as a side check?

I don’t have so much information about Swagger, can you explain to me what do you mean ?

with swagger we can learn and prototype ORC Rest Calls

Authorize at first
grafik

then prototype the call

Hello, I checked even If I don’t understand Swagger much, but I can start job with Postman.
I can’t start a job inside of automation using HTTP Orchestrator Request activity

thats good, because we can port the settings / done item from Postman to HTTP Orchestrator Request. In general it is about the URL and the body payload

The problem starts with Json Payload, I can’t use the json payload in the activity which I use in postman. If you look at the videos I provided with links you will understand

I exactly do the same thing with videos but I can’t understand I can’t reach to my goal

we do have several options to prepare the Json

Assign / Payload field - Singleline with escaped inner " like:
“{”“ABC”“: {”“CDE”“: 123},”“EFG”“:”+Var1+“}”

OR
Reading a text template with placeholders and replace the placeholders with

  • String Replace
  • String.Format Method and options

Just to mention a few options.

Unfortunately, I’ve already tried these and they always give some syntax errors.

Also I checked my writing style from this website:
JSON Online Validator and Formatter - JSON Lint

please share your XAML, so we can inspect. Also share with us a screenshot from the reference Packages, as we can check for the same settings. Thanks

I tried more about your last response and finally I made it work!!!

Thank you!!

1 Like

Perfect, so the topic can be closed
Forum FAQ - How to mark a post as a solution - News / Tutorials - UiPath Community Forum

I would like to close but now I am facing issue while adding double value json string
Is there way to assign double value directly or do I have to transform it into string ?

I got this error:
Orchestrator HTTP Request: Expression Activity type ‘VisualBasicValue`1’ requires compilation in order to run. Please ensure that the workflow has been compiled.

with this JSON
"{""startInfo"":{""ReleaseKey"":""--------"",""Strategy"":""ModernJobsCount"",""JobPriority"":""High"",""InputArguments"":""{\""strCompany\"":\""------\"",\""strURL\"":\""" & strURL & "\"",\""strSize\"":\""" & strSize & "\"",\""doublePrice\"":" & doublePrice & ",\""createdOrderUID\"":\""" & createdOrderUID & "\""}"",""JobsCount"":1}}”

Hi @gururaser

Can you please retype the double quote