Parse XML response with special characters as valid xml

Hi,

I am receiving soap response as below:

When I am trying to apply xml to json policy the text between GetQuoteResult node is being considered as string and returning the json as:

{
  "Envelope": {
    "Body": {
      "GetQuoteResponse": {
        "GetQuoteResult": "<StockQuotes><Stock><Symbol>BAC</Symbol><Name>BANK OF AMERICA C</Name></Stock></StockQuotes>"
      }
    }
  }
}

But I want the output as below: Please help me,

{
  "Envelope": {
    "Body": {
      "GetQuoteResponse": {
        "GetQuoteResult": {"StockQuotes":{"Stock":{"Symbol":"BAC","Last":"16.61","Date":"2/13/2015","Time":"4:05pm","Change":"0.06","Open":"16.73","High":"16.79","Low":"16.54}}
      }
    }
  }
}

1 Like

I have sorted the issue by applying XSL transformation to convert < to < and > to >. Then used Assign Message policy to pass it to Xml To Json policy. However I am looking for an implicit solution.

Kiran: You’re on the right track. We don’t have an implicit solution ATM.

1 Like

The XmlToJson policy adds a escape character when the date passed. The xml tag 01/12/2017 converts as date: 01/12/2017. How to avoid the escape character \ during this conversion.