OutpoutParameter JSON form

I have 2 applications: Camunda BPMN and Symfony2. I sent the inputParameter of Camunda by REST API and Connector to my Symfony2 application. It’s OK. The response is JSON form.
How can the outputParameter read the JSON form?

This is the method in my Symfony2 application:

/**
     * @param Request $request
     * @Rest\Get("/api/getProcess")
     * @return JsonResponse
     */
    public function getProcess(Request $request){
        $amount=array();
        if($request->get("amountConnector") !='' && $request->get("amountConnector") >=100){
        $amount= $request->get("amountConnector") - 100;
        }
        //return new Response(($amount), 200);
        return $this->getResponseJson(200,array('amount'=>$amount));
    }

This is the connector in process.bpmn:
< camunda:connector>
< camunda:connectorId>http-connector< /camunda:connectorId>
< camunda:inputOutput>
< camunda:inputParameter name=“url”>
< camunda:script scriptFormat=“juel”>http://serverName/api/getProcess?amountConnector=${amount}< /camunda:script>
< /camunda:inputParameter>
< camunda:inputParameter name=“method”>GET< /camunda:inputParameter>
< camunda:inputParameter name=“amountConnector”>${amount}< /camunda:inputParameter>
< camunda:inputParameter name=“headers”>
< camunda:map>
< camunda:entry key=“Accept”>application/json< /camunda:entry>
< /camunda:map>
< /camunda:inputParameter>
< camunda:outputParameter name=“amount”>${response}< /camunda:outputParameter>
< /camunda:inputOutput>
< /camunda:connector>

Thank you

@fatma_wings you need to parse the response with Camunda SPIN (https://docs.camunda.org/manual/7.6/reference/spin/json/01-reading-json/).

${response} should be:

${S(response)}

It displays this error:

hmm, I had thought i remembered that SPIN was accessible through EL.

Change your output param to Type Script, use Javascript and have the value be: S(response);

It passes to the next task.
This is my JSON response: {“amount”:5300}
I want to the vallue in my form as long type because it displays this error:

This is solution of my last error:
< camunda:outputParameter name=“amount”>
< camunda:script scriptFormat=“Javascript”>${S(response).prop(“amount”).value().toString()}< /camunda:script>
< /camunda:outputParameter>

I don’t understand this error:

That means the object you pass to the S function cannot be interpreted as JSON or XML.

Thank you @thorben for your anwser :slight_smile:

I have another error message :frowning:


I don’t understand it :disappointed:

Please provide your script

loanApprovalProcess.bpmn (12.1 KB)

just use S(response) and make sure your are getting back the proper JSON.

I resolve my problem. The WS of Symfony2 project is closed :grin:
I modify the configuration of the project.

I don’t understand this eroor:

@fatma_wings you must provide more information about the script that is causing this error.