0

I have a multipart/form data content type request, which looks like this:

--AbCdeFGHijkL
Content-Disposition: form-data; name="json_standingorderType"
Content-Type: application/json; charset=UTF-8
Content-Transfer-Encoding: 8bit

{"startDate":"2020-12-31","executionRule":"preceding","frequency":"Monthly","dayOfExecution": "31"}
--AbCdeFGHijkL
Content-Disposition: form-data; name="xml_sct"
Content-Type: application/xml; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit

<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03">
    <CstmrCdtTrfInitn>
        <GrpHdr>
            <MsgId>MSG{{endToEndIdentification}}</MsgId>
            <CreDtTm>{{CreDtTm}}</CreDtTm>
            <NbOfTxs>1</NbOfTxs>
            <CtrlSum>{{betragOk}}</CtrlSum>
            <InitgPty>
                <Nm>XS2A Tester</Nm>
            </InitgPty>
        </GrpHdr>
        <PmtInf>
            <PmtInfId>NOTPROVIDED</PmtInfId>
            <PmtMtd>TRF</PmtMtd>
            <NbOfTxs>1</NbOfTxs>
            <CtrlSum>{{betragOk}}</CtrlSum>
            <ReqdExctnDt>1999-01-01</ReqdExctnDt>
            <Dbtr>
                <Nm>XS2A Tester</Nm>
            </Dbtr>
            <DbtrAcct>
                <Id>
                    <IBAN>{{debtorAccountIBAN}}</IBAN>
                </Id>
            ...

I am trying to get the frequency from the json on the top, how can I accomplish this? I am using NodeJS.

Yasin Eraslan
  • 171
  • 2
  • 13
  • 1
    What specific problem are you having? Parsing the multipart request? Parsing the JSON once you've extracted it from the request? – Quentin Mar 25 '21 at 15:57
  • 1
    How are you getting the request? If you want to parse it and it is a request being made to (say) Express then the answer will probably involve using some Express middleware, but if it is an email body or something else then the answer will be different. – Quentin Mar 25 '21 at 15:58
  • i mean I guess i can get the body via request.body but I have no idea how I could get that json on top – Yasin Eraslan Mar 25 '21 at 15:58
  • It is a request to a server which i handle with express – Yasin Eraslan Mar 25 '21 at 15:59
  • 1
    https://stackoverflow.com/questions/56758241/node-js-express-how-to-get-data-from-body-form-data-in-post-request – Quentin Mar 25 '21 at 16:01

0 Answers0