conductor icon indicating copy to clipboard operation
conductor copied to clipboard

unable to extract key value from JSON output of http task

Open sudvarma opened this issue 8 years ago • 5 comments


Unable to extract value from the JSON {"value": "More content"}

"outputParameters": { "a":"${gd.output.response.body.value}", "b":"${gd.response.body.value}", "c":"${gd..*}" },


only value for 'c' is printed correctly - the value for 'a' and 'b' shows null. Any pointers would help.


{ "createTime": 1530551843180, "updateTime": 1530551843219, "status": "COMPLETED", "endTime": 1530551843219, "workflowId": "040327fa-9878-4b6f-9c7d-3602dfe9f09d", "tasks": [ { "workflowInstanceId": "040327fa-9878-4b6f-9c7d-3602dfe9f09d", "taskId": "0931ce8b-5c66-4683-8321-0d7eedf2a6e2", "callbackAfterSeconds": 0, "workerId": "m-C02VN0XVG8WN", "status": "COMPLETED", "outputData": { "response": { "body": { "value": "More content" }, "headers": { "Transfer-Encoding": [ "chunked" ], "Server": [ "Jetty(9.2.z-SNAPSHOT)" ], "Content-Type": [ "application/json" ] }, "statusCode": 200 } }, "taskType": "HTTP", "inputData": { "http_request": { "uri": "http://localhost:9999/api/mytest", "method": "GET", "Content-Type": "application/json" } }, "referenceTaskName": "gd", "retryCount": 0, "seq": 1, "correlationId": "23", "pollCount": 0, "taskDefName": "getDeliveryDetails", "scheduledTime": 1530551843188, "startTime": 1530551843193, "endTime": 1530551843223, "updateTime": 1530551843223, "startDelayInSeconds": 0, "retried": true, "callbackFromWorker": true, "responseTimeoutSeconds": 0, "queueWaitTime": 5, "taskStatus": "COMPLETED" } ], "input": { "deliveryId": 70008361, "dcNumber": 32944, "receivingUserId": "TestAuto", "itemUPCNumber": "7329900009", "itemNumber": "9231599", "problemType": "NOP", "purchaseReferenceNumber": "0414633399", "palletTi": 3, "palletHi": 2, "problemQty": 10, "printerId": "22", "shippedTo": "32921", "comment": "test", "oms_po_fetch_url": "http://localhost:9999/GENERIC/OMSPubSubGenericRead2/", "inbound_search_po_url": "http://localhost:9999/api/mytest" }, "output": { "a": null, "b": null, "c": [ { "response": { "body": { "value": "More content" }, "headers": { "Transfer-Encoding": [ "chunked" ], "Server": [ "Jetty(9.2.z-SNAPSHOT)" ], "Content-Type": [ "application/json" ] }, "statusCode": 200 } }, { "http_request": { "uri": "http://localhost:9999/api/mytest", "method": "GET", "Content-Type": "application/json" } }, { "body": { "value": "More content" }, "headers": { "Transfer-Encoding": [ "chunked" ], "Server": [ "Jetty(9.2.z-SNAPSHOT)" ], "Content-Type": [ "application/json" ] }, "statusCode": 200 }, { "uri": "http://localhost:9999/api/mytest", "method": "GET", "Content-Type": "application/json" }, "http://localhost:9999/api/mytest", "GET", "application/json" ] }, "workflowType": "Sample_problemApp_flow_4", "version": 1, "correlationId": "23", "schemaVersion": 0, "startTime": 1530551843180 }

sudvarma avatar Jul 02 '18 17:07 sudvarma

Any pointers would help. Thanks

sudvarma avatar Jul 03 '18 13:07 sudvarma

[ { "name": "Sample_problemApp_flow_4", "correlationId": "23", "description": "Sample_problemApp_flow_4", "version": 1, "tasks": [ { "type": "HTTP", "name": "task1", "taskReferenceName": "t1", "inputParameters": { "http_request": { "uri": "${workflow.input.task1_url}", "method": "POST" } }, "headers": { "Accept": "application/json", "Content-Type": "application/json" }
} ], "outputParameters": { "a":"${t1.output.*}", "b":"${t1.output.response.body[0].testnum}" }, "schemaVersion": 2 } ]

In the above workflow, t1.output.* prints the whole output where as extracting a particular value from JSON prints null.

Below is the sample output:- "outputData": { "response": { "body": [ { "testnum": 2, "teststr": "sudheesh" } ], "headers": { "Transfer-Encoding": [ "chunked" ], "Server": [ "Jetty(9.2.z-SNAPSHOT)" ], "Content-Type": [ "application/json; charset=UTF-8" ] }, "statusCode": 200 } },

sudvarma avatar Jul 03 '18 17:07 sudvarma

@jvemugunta

Could you take a look?

sudvarma avatar Jul 03 '18 18:07 sudvarma

The issue seems to be with an older jar[conductor-server-1.6.1-all.jar] of conductor - moved to the latest and it works fine.

sudvarma avatar Jul 04 '18 06:07 sudvarma

I tested with server version 1.11.0 and found the syntax for getting the value of a key is like the following: "${task_1.output..response.body.data[0].offering.code}" (Notice the two dots ".." after output).

rehabaam avatar Jul 08 '18 10:07 rehabaam