FasterXML / FasterXML/jackson-dataformat-xml
Allow preserving "is-attribute" with JsonNode to write output as attribute value
- Dominant language
- Java
- Stars
- 631
- Forks
- 246
- Avg merge
- 7d 9h
- Merged PRs (30d)
- 13
Description
I want to map a JsonNode to a XML. If I directly call XmlMapper write methods, this converts all the SubNode's of JsonNode as XMLElement which is fine.
But I want one of the field/subfield convert as XMLAttribute.
Is there a way to tell the mapper 'this node is not element, please convert it as attribute?'
Check the **_**OrgnlIntrBkSttlmAmt**_** field below (XML and json format is not preserved, sorry for that)
A sample JSON file is as follows :
```json
{
"FIToFIPmtCxlReq": {
"Undrlyg": [
{
"TxInf": [
{
"CxlId": "3EfXiRbNk517MHY",
"OrgnlInstrId": "0amcNeP5QhXnY9x3Ykkj5TScqoTQF",
"OrgnlIntrBkSttlmAmt": {
"Ccy": "EUR",
"Value": 1462216
}
}
]
}
]
}
}
```
The converted XML is as follows
```xml
3EfXiRbNk517MHY
0amcNeP5QhXnY9x3Ykkj5TScqoTQF
yy
EUR
1462216
```
The requested output is as follows:
```xml
3EfXiRbNk517MHY
0amcNeP5QhXnY9x3Ykkj5TScqoTQF
yy
1462216
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.