-1

Hi I am using "XML to JSON" policy to change my XML into JSON but it is adding an extra "$" character. not sure what is the benefit of having it and how to get rid of that. Currently: hello becomes { "a": { "$" : "hello" } } Expecting it to return { "a": "hello" }

Can anyone please help here?

shri kant
  • 85
  • 12

2 Answers2

0

Just because it uses Badger Fish for Transformation. For this you can use Mapper policy to map your attributes to transform from XML to JSON.

user1162546
  • 13
  • 1
  • 6
  • Thanks for the response but its hard to change in mapper policy when we have a complex structure. If you use "JSON to XML" after "XML to JSON", it won't give you expected format. Still not sure the benefit of it or maybe I have no idea about the actual use case. – shri kant Jan 30 '19 at 22:26
  • Just create definitions accordingly to your desired complex structure and in mapper just map your XML to created definition in Output its pretty easy. If you have an idea about Custom polices you can also develop policy in Datapower – user1162546 Feb 15 '19 at 06:59
0

The best way to do XML to JSON and JSON to XML transforms is using the mapping node, if you use the "automatic" nodes, it is slower than the mapping nodes and also might have weird behaviours like adding "$" or later removing them... (according to my experience, if the XML has attributes, it might remove the "$".. so I moved to mapping nodes and ready..)