I want to get just the id and name from the object the rest of the data are irrelevant to me.
Can you pleas help me how to go about that.
def call(param) do
System.get_env("LOCATION_SERVICE_HOST") <> param
|> HttpClient.get
|> format_response
end
def format_response({ok, response}) do
response
end
The response of call function
[
{
"countryCode": "IN",
"courierApplicable": false,
"id": 1,
"isActive": true,
"name": "",
"stateId": 5,
"supplierCityId": 1
},
{
"countryCode": "IN",
"courierApplicable": false,
"id": 2,
"isActive": true,
"name": "",
"stateId": 1,
},
...
]
Expected result
[
{
"id": 1,
"name": ""
},
{
"id": 2,
"name": ""
},
...
]