I am working to convert some xml to json .EX:For the below
John Doe
Anna Smith
Peter Jones
I convert this XMl by converting to document and then to JSON
I get this - an array of items in json (which is what I need):
{“employees”:{“employee”:[{“firstName”:“John”,“lastName”:“Doe”},{“firstName”:“Anna”,“lastName”:“Smith”},{“firstName”:“Peter”,“lastName”:“Jones”}]}}
But when there is only one it quite understandably converts like this (not an array):
{“employees”:{“employee”:{“firstName”:“John”,“lastName”:“Doe”}}}
My app developer who is reading this needs theJSON to return an array of items regardless or whether there is one or more.
Is there a way of tricking it into thinking it’s an array or can someone suggest another way of doing this?
#webMethods#Integration-Server-and-ESB