How can I search for a value in a response coming from the Invoke REST API palette in JSON format? :et me explain better, the service response is dynamic, based on the request sent the response will be different. I want to dynamically search via the key for the corresponding value.
I tried to use the Invoke REST API palette in sequence and passed the response obtained to ParseJSON set in generic mode, so as to obtain the transformation of the JSON into XML and the result of the palette into a ParseXML and here I saw that the selected element is dynamic. I can't insert an XSD into the palette to retrieve the value.
Overall the challenge here is that BusinessWorks is using XML and every data structure need to be defined by an XML schema.
You can consider different approaches:
#1 Extract the values you are looking for from the string in the output of the Invoke REST API activity using string functions like substring-before and substring-after
#2 Use the Parse JSON activity with the 'Generic' option and later use XSLT with the Transform XML activity to extract the needed values and create an XML document you can use in BusinessWorks.
#3 Use the Parse JSON activity with the 'Generic' option and create an XML schema for each possible JSON structures (one XML schema per JSON structures). Then create a Parse XML activity for each defined XML schema and have some conditional transitions to use the correct Parse XML activity depending on the received JSON structure. To be able to do this you need to have in the JSON structure (or in an HTTP header) a field that would be always present and that would allow you to identify which XML schema to use.
#4 Use the Parse JSON activity with the 'Generic' option and create a single XML schema that would allow to manage all the possible cases (to do that you may have to use some optional fields or optional parts in the XML schema).
Then Parse the XML structure using the Parse XML activity configured with the defined XML schema. It might not always be possible to use such approach.