Reputation: 11
we use krakend and a plugin for soap to json conversion
{{if .promotionData}}
"promotionData": {
"identifier" : "{{.promotionData.identifier}}",
"description": "{{.promotionData.description}}"
{{if .promotionData.promotionBundleId}}
,"promotionBundleId": [
{{- range $index, $id := .promotionData.promotionBundleId -}}
{{- if $index}},{{end}}"{{ $id }}"{{- end -}}
]
{{end}}
{{if .promotionData.promotionServiceId}}
,"promotionServiceId": [
{{- range $index, $ele := .promotionData.promotionServiceId -}}
{{- if $index}},{{end}}"{{ $ele }}"{{- end -}}
]
{{end}}
}
{{else}}
"promotionData" : []
{{end}}
expcted json response, some like Here promotionBundleId and promotionServiceId can have empty, one value or multiple,if multiple then comma need to be there. one of the expected output should be "promotionData": { "description": "promowithOnlyServiceDesc", "identifier": "promowithOnlyServiceRule", "promotionServiceId": ["2", "5", "3"], "promotionBundleId": ["555"] }
but facing error
but facing issue
2024-05-20 12:35:16 "promotionData": {
2024-05-20 12:35:16 "identifier" : "promoRulewithOnlyOneBundle",
2024-05-20 12:35:16 "description": "promowithOnlyOneBundledesc"
2024-05-20 12:35:16
2024-05-20 12:35:16 ,"promotionBundleId": [
2024-05-20 12:35:16
2024-05-20 12:35:16
2024-05-20 12:35:16 2024/05/20 07:05:16 [Recovery] 2024/05/20 - 07:05:16 panic recovered:
2024-05-20 12:35:16 unexpected end of JSON input
2024-05-20 12:35:16 /build/apigw-plugins/modifierPlugin/modifierPlugin.go:396 (0x7fa68965a724)
2024-05-20 12:35:16 /build/apigw-plugins/modifierPlugin/modifierPlugin.go:227 (0x7fa689658b1e)
2024-05-20 12:35:16 /go/pkg/mod/github.com/luraproject/lura/[email protected]/proxy/plugin.go:179 (0x18537c1)
2024-05-20 12:35:16 /go/pkg/mod/github.com/luraproject/lura/[email protected]/proxy/plugin.go:104 (0x1853171)
i have tried multiple times with comma inside array manipulation
Upvotes: 1
Views: 34