Hi,
I have an XML API that returns URLs with characters like &. I am trying to convert it into JSON using Golang templates. But it always fails with the below error in Gateway service:
ERROR Failed to decode body: json: cannot unmarshal string into Go value of type []main.DBPolicy
Below error in dashboard service (test from Endpoint Designer):
ERROR Error unmarshalling XML: xml.Decoder.Token() - XML syntax error on line 8: invalid character entity &fmt (no semicolon)
When I test removing ‘&’ character, it works perfectly (test in Endpoint Designer). How to workaround this? I need this to be converted to JSON.
API Response:
<?xml version='1.0' encoding='UTF-8'?>
<sitemapindex xmlns='http://www.sitemaps.org/schemas/sitemap/0.9'>
<listing>
<merchant>macy</merchant>
<url>http://upcdeal.us/go.php?url=UPC_039372614225-aHR0cDovL2NsaWNrLmxpbmtzeW5lcmd5LmNvbS9saW5rP2lkPTVSdGxEanYvQkU4Jm9mZmVyaWQ9MjA2OTU5LjM5MzcyNjE0MjI1JnR5cGU9MTUmbXVybD1odHRwOi8vd3d3MS5tYWN5cy5jb20vc2hvcC9wcm9kdWN0L3ZpbmNlLWNhbXV0by1zbGVldmVsZXNzLXN0cmlwZWQtbWF4aS1kcmVzcz9JRD0yNzYwNTQ4JlBhcnRuZXJJRD1MSU5LU0hBUkUmY21fbW1jPUxJTktTSEFSRS1fLTItXy03OS1fLU1QMjc5Kioqc2tkbGpl</url>
<price>$149.00</price>
<name> Vince Camuto Sleeveless Striped Maxi Dress</name>
<imageurl>http://slimages.macys.com/is/image/MCY/products/6/optimized/3599616_fpx.tif?wid=300&fmt=jpeg&qlt=100</imageurl>
<shipping>$0.00</shipping>
<condition>New</condition>
</listing>
</sitemapindex>
Thanks in advance.
Prasad