Hi I’ve a list of nested maps as like this
[
%{
ingredients: [
%{"measuring_unit" => "gms", "name" => "okra/bhindi", "qty" => 450},
%{"measuring_unit" => "tbsp", "name" => "vegetable oil", "qty" => "2"},
%{
"measuring_unit" => "tbsp",
"name" => "desiccated coconut powder",
"qty" => 4
},
%{"measuring_unit" => "tbsp", "name" => "coriander powder", "qty" => 2},
%{"measuring_unit" => "tbsp", "name" => "cumin powder", "qty" => 2},
%{"measuring_unit" => "tbsp", "name" => "ground cumin", "qty" => 1.5},
%{"measuring_unit" => "tbsp", "name" => "cinnamon stick", "qty" => 1},
%{
"measuring_unit" => "tbsp",
"name" => "dried mango powder, also known as amchur",
"qty" => 1
},
%{
"measuring_unit" => "tbsp",
"name" => "red pepper flakes",
"qty" => 0.25
},
%{"measuring_unit" => "tbsp", "name" => "red chili powder", "qty" => 1},
%{"measuring_unit" => "tbsp", "name" => "garam masala", "qty" => 1},
%{"measuring_unit" => "tbsp", "name" => "turmeric powder", "qty" => 0.25},
%{"measuring_unit" => "tbsp", "name" => "salt, or to taste", "qty" => 2},
%{
"measuring_unit" => "tbsp",
"name" => "vegetable oil, divided",
"qty" => 2
}
],
name: "Stuffed Bhindi",
other_ingredients: []
},
%{
ingredients: [
%{"measuring_unit" => "gms", "name" => "okra/bhindi", "qty" => 450},
%{"measuring_unit" => "tbsp", "name" => "vegetable oil", "qty" => "2"},
%{
"measuring_unit" => "tbsp",
"name" => "desiccated coconut powder",
"qty" => 4
},
%{"measuring_unit" => "tbsp", "name" => "coriander powder", "qty" => 2},
%{"measuring_unit" => "tbsp", "name" => "cumin powder", "qty" => 2},
%{"measuring_unit" => "tbsp", "name" => "ground cumin", "qty" => 1.5},
%{"measuring_unit" => "tbsp", "name" => "cinnamon stick", "qty" => 1},
%{
"measuring_unit" => "tbsp",
"name" => "dried mango powder, also known as amchur",
"qty" => 1
},
%{
"measuring_unit" => "tbsp",
"name" => "red pepper flakes",
"qty" => 0.25
},
%{"measuring_unit" => "tbsp", "name" => "red chili powder", "qty" => 1},
%{"measuring_unit" => "tbsp", "name" => "garam masala", "qty" => 1},
%{"measuring_unit" => "tbsp", "name" => "turmeric powder", "qty" => 0.25},
%{"measuring_unit" => "tbsp", "name" => "salt, or to taste", "qty" => 2},
%{
"measuring_unit" => "tbsp",
"name" => "vegetable oil, divided",
"qty" => 2
}
],
name: "Normal Bhindi",
other_ingredients: []
}
]
I just wanted to extract the data where name = “Stuffed Bhindhi”
I tried this ingre_map = Enum.take_while(ingredientslist, fn x -> ingredientslist[:name] == “Stuffed Bhindhi”)
but didn’t work getting nil