Page 1 of 1
Get value from JSON
Posted: Thu May 07, 2026 4:07 pm
by Rukbunker
I'm struggling a bit with getting a value from a JSON string.
{"jobStatus":{"jobId":"69fca4afa1630f5937153bff","created":1778164911572,"language":"nl","status":"OPEN","nrAudioSeconds":23,"transcriptionType":"transcription","filename":"xxx.ext","jobType":"direct","jobOptions":{"burnInSubtitles":false,"anonymization":"NONE","portal":true,"timestampEnabledInExport":true,"dresingPehl":false,"extendedDelivery":"NONE"}}}
I need just the JobId. I've played around with loops, XML Node, but I can't get it working. What is your best method, Oleg?
Re: Get value from JSON
Posted: Thu May 07, 2026 4:31 pm
by Oleg
Use the expression:
{json:_string.jobStatus.jobId}
where
_string is the variable name
Please note that JSON is
case sensitive
Look at my example below:
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|307868550
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task1583"
Hide=INTEGER|0
ID=INTEGER|928583325
LogOnAsUser=INTEGER|1
Name=STRING|"Parse JSON"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RestrictRESTAPIAccess=INTEGER|0
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
StepPause=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
Action2=FOLDER
[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""_string"" with value ""{""jobStatus"":{""jobId"":""69fca4afa1630f5937153bff"",""created"":1778164911572,""language"":""nl"",""status"":""OPEN"",""nrAudioSeconds"":23,""transcriptionType"":""transcription""..."""
Params=FOLDER
[Actions\Action1\Params]
_rt_variables_produced=STRING|"_string"
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"_string"
varvalue=STRING|"{""jobStatus"":{""jobId"":""69fca4afa1630f5937153bff"",""created"":1778164911572,""language"":""nl"",""status"":""OPEN"",""nrAudioSeconds"":23,""transcriptionType"":""transcription"",""filename"":""xxx.ext"",""jobType"":""direct"",""jobOptions"":{""burnInSubtitles"":false,""anonymization"":""NONE"",""portal"":true,""timestampEnabledInExport"":true,""dresingPehl"":false,""extendedDelivery"":""NONE""}}}"
[Actions\Action2]
ActionID=STRING|"A_DIALOG_SHOWTEXT"
Enabled=INTEGER|-1
Name=STRING|"Show Text"
Params=FOLDER
[Actions\Action2\Params]
autoclose=STRING|"0"
fromfile=STRING|"1"
line00000000=STRING|"source string: {_string}"
line00000001=STRING|"***********"
line00000002=STRING|"Job ID: {json:_string.jobStatus.jobId}"
line00000003=STRING|"Created: {json:_string.jobStatus.created}"
line00000004=STRING|"Language: {json:_string.jobStatus.language}"
line00000005=STRING|"Status: {json:_string.jobStatus.status}"
line00000006=STRING|"Audio Seconds: {json:_string.jobStatus.nrAudioSeconds}"
line00000007=STRING|"File Name: {json:_string.jobStatus.filename}"
linecount=STRING|"8"
timeout=STRING|"10"
Re: Get value from JSON
Posted: Thu May 07, 2026 4:45 pm
by Oleg
Also read this topic:
viewtopic.php?p=12298
Re: Get value from JSON
Posted: Thu May 07, 2026 4:46 pm
by Rukbunker
You are the best. As usual. Thanks!