DEV Community

Discussion on: Converting XML to JSON using Recursion

Collapse
 
david_burg profile image
David Burg

This will not generate a consistent schema for arrays as it cannot distinguish single element arrays from other complex type. As the xml document doesn't declare arrays you need to fetch the xml schema from the service and look up each complex node element schema for its maxoccur setting. If more than 1, you need to use an array in Json so your payload schema is consistent. Without that you will mostly work and you won't reliably work. I like my services reliable.