FasterXML / FasterXML/jackson-dataformat-xml
Allow preserving "is-attribute" with JsonNode to write output as attribute value
- Langage dominant
- Java
- Étoiles
- 631
- Forks
- 246
- Merge moyen
- 7 j 9 h
- PR mergées (30 j)
- 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
```
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.