Parse JSON text

  

Hi All,

I am trying to parse text which contains the combination of JSON and another sample text. I just want to parse JSON data and avoid another string. You can see the sample text below that I want to parse.


<case><caseInformation><caseNumber>34897741</caseNumber><caseId>5003B000003A8SHQA0</caseId><subject>Fwd: This is not an order</subject><description/><customerRequest>Fwd: This is not an order</customerRequest><origin>Web</origin><status>New</status><creationDate>2018-01-15T10:22:56.000Z</creationDate><isClosed>false</isClosed><isEscalated>false</isEscalated><lastModifiedDate>2018-01-15T10:23:02.000Z</lastModifiedDate><CCCountryCode>ES</CCCountryCode><severity>Normal</severity><priority>Normal</priority><quantity>1.0</quantity></caseInformation><contactInformation><name>OCRContact Unique</name><emailAddress>ocrcontact1uniue@gmail.com</emailAddress><accountName>Spain Test Account</accountName><country>Spain</country></contactInformation><ownerName>Case - Primary Support Center Queue</ownerName></case>{"caseNumber":34897741,"caseId":"5003B000003A8SHQA0"}


I want to parse only last line and ignore rest things, Is it possible?

Please let me know the best approach to do this.


Thanks in advance,

Gopal

yes it's possible.


depends how you want to approach it, but if you know the json-part always starts after </case>, it's simply a search and extract. To be honest, I amn not sure why you are asking this?


Hi J,

Thak you for the quick reply.

I am consuming REST API that gives JSON result. But many time API gives string with JSON data (That's the problem with API, the API team are working on this). As you said we can extract JSON if we know the pattern, but I am not sure about the API result. 

While testing the same API with Postman, Postman takes only JSON. So I thought we can also do the same with Outsystems.