I have a String input to my API. It can be either XML or JSON and I need to use the Read function on it to parse it into JSON. What is the best way in MuleSoft 4 or Dataweave 2 to determine what format the String is in?
Maybe I could write a function isXML(String inputString) or isJSON(String inputString).
As of now, I have something inelegant. I'm trying to parse the input as XML and catching any parsing exceptions. Inside the catch, I'll try to parse it as JSON. I guess it's not a horrible solution.