0
votes

I've a JSON response based on a webservice request.

     [
       {
        "type": " --T::00"
       },
    {
       "address": "10049 College Way N",
       "longitude": "-122.335022",
       "latitude": "47.701756",
      "incident_number": "F110104009",
       "type": "Aid Response",
       "report_location": {
       "needs_recoding": false,
       "longitude": "-122.335022",
       "latitude": "47.701756"
      }
     },
      {
      "address": "5929 Beach Dr Sw",
      "longitude": "-122.397816",
      "latitude": "47.550431",
      "incident_number": "F110104008",
       "type": "Aid Response",
       "report_location": {
       "needs_recoding": false,
       "longitude": "-122.397816",
       "latitude": "47.550431"
       }
      }

Is there a way to manipulate the payload to remove this from the header { "type": " --T::00" } or just add it in the footer. I currently use a JSON to Object transformer and added java.util.List. I've seen posts of using a groovy transformer to add to the message but how about removing elements such as the header?

Thanks!

1

1 Answers

0
votes

What you can do is :-
1. Extract all the elements value from the JSON request using <json:json-to-object-transformer/> and store them in some variables.
2. Try to build your own JSON request using Mule Expression Transformer and assign the values from variable. Thus, you can create a Dynamic JSON you require..

You can check here how to build Dynamic JSON using Expression Transformer :- How to transform json-to-json document in Mule ESB