I am trying to retrieve posts from the JSON data with a certain tag.
data: any =
[
{"id": 1,
"title": "title 1",
"description": "Lorem Ipsum.",
"by": "author",
"tags": [
{ "tag":"facebook" },
{ "tag": "twitter" } ]
},
{"id": 2,
"title": "title 2",
"description": "Lorem Ipsum.",
"by": "author",
"tags": [
{ "tag": "google" },
{ "tag": "twitter" } ]
},
{"id": 3,
"title": "title 3",
"description": "Lorem Ipsum.",
"by": "author",
"tags": [
{ "tag": "reddit" },
{ "tag": "instagram" } ]
},
{"id": 4,
"title": "title 4",
"description": "Lorem Ipsum.",
"by": "author",
"tags": [
{ "tag":"reddit" },
{ "tag":"9gag" } ]
}
];
The output I want to retrieve are the post using a certain tag. let's say that the certain tag I want is "9gag", the result should output something like this:
result: any =
[
{"id": 3,
"title": "title 3",
"description": "Lorem Ipsum.",
"by": "author",
"tags": [
{ "tag": "reddit" },
{ "tag": "instagram" } ]
},
{"id": 4,
"title": "title 4",
"description": "Lorem Ipsum.",
"by": "author",
"tags": [
{ "tag":"reddit" },
{ "tag":"9gag" } ]
}
];