0

I want to filter my json data based on my request. so if my request is like /user it gives me the full json data as result and if i give /user?bikes it filters me the result with json result with bike data and if i use /user?cars it filters me json data with car as result. Below is my json payload .

{
    "name": "John",
    "age": 30,
    "cars": {
        "car1": "Ford",
        "car2": "BMW",
        "car3": "Fiat"
    },
    "bikes": {
        "bike1": "ducati",
        "bike2": "BMW",
        "bike3": "honda"
    }
}

so /user will give full data

/user?bikes will be -

{
     "bikes": {
        "bike1": "ducati",
        "bike2": "BMW",
        "bike3": "honda"
    }
}

/user?cars will be -

{
 "cars": {
        "car1": "Ford",
        "car2": "BMW",
        "car3": "Fiat"
    }
}

Please let me know how this can be used using mulesoft

jerney
  • 2,187
  • 1
  • 19
  • 31
user3428616
  • 65
  • 4
  • 14

0 Answers0