我正在使用apache速度进行json转换。下面是我的 json 字符串
{
"apiCode": "Payment Execution Service",
"name": "Initiate a payment",
"description": "Initiate a payment",
"request": {
"method": "POST",
"path": "/api/v1/payments",
"headers": [
{
"Corporate-ID": "apiKey"
},
{
"Content-Type": "application/json"
}
],
"body": "{\n \"beneficiaryInformation\" : {\n \"destinationAccountIdentifier\" : \"string\",\n \"destinationBankIdentifier\" : \"DEUTDEDB237\",\n \"fullName\" : \"JASON SMITH\"\n },\n \"purposeOfPayment\" : \"Invoice Payment\",\n \"remittanceInformation\" : \"Mantainance of Fixtures\",\n \"remitterInformation\" : {\n \"sourceAccountCurrency\" : \"EUR\",\n \"sourceAccountIdentifier\" : \"string\",\n \"sourceBankIdentifier\" : \"DEUTDEDBFRA\"\n },\n \"transferAmount\" : 1.5,\n \"transferCurrency\" : \"EUR\",\n \"transferDate\" : \"2015-07-20\",\n \"transferType\" : \"SCTInst\",\n \"uniqueRequestNo\" : \"string\"\n}"
},
"response": {
"status": 200,
"headers": [
{
"Content-Type": "application/json"
}
],
"body": "{\n \"requestReferenceNo\" : \"string\",\n \"transactionStatus\" : {\n \"bankReferenceNo\" : \"string\",\n \"reasonCode\" : \"string\",\n \"statusCode\" : \"string\"\n }\n}"
},
"provider": "Payment Execution Service"
}
下面是我的 .vm 文件
{
"provider": {
"name": "$arr[0].apiCode"
},
"consumer": {
"name": "$arr[0].provider"
},
"interactions": [
#set($i = 0)
#foreach($a in $arr)
{
"description": "$a.description",
"request": {
"path": "$a.request.path",
"method": "$a.request.method",
"headers": $json.valueToString($a.request.headers),
"body": $json.valueToString($a.request.body)
},
慕的地8271018
ITMISS
随时随地看视频慕课网APP
相关分类