How to get category id from WordPress response

I tried below code

 this.http.get(this.URL+this.categoryID)
	   	.map(res => res.json())
	    .subscribe(data => {
	      // we've got back the raw data, now generate the core schedule data
	      // and save the data for later reference
	      this.items = data;
		
		  alert (this.items.id) // Showing undefined
	    });

How to fix can you please help me.

Below is my json response

{"id":10,"date":"2017-08-21T05:32:33","date_gmt":"2017-08-21T05:32:33","guid":{"rendered":"mysite/ionic2/sumitdemo/quotes/?p=10"},"modified":"2017-08-21T05:45:11","modified_gmt":"2017-08-21T05:45:11","slug":"man-needs-difficulties","status":"publish","type":"post","link":"mysite/ionic2/sumitdemo/quotes/man-needs-difficulties/","title":{"rendered":"Man needs difficulties"},"content":{"rendered":"<p>“Man needs difficulties in life because they are necessary to enjoy the success.” </p>\n","protected":false},"excerpt":{"rendered":"<p>“Man needs difficulties in life because they are necessary to enjoy the success.”</p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"quote","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"mysite/ionic2/sumitdemo/quotes/wp-json/wp/v2/posts/10"}],"collection":[{"href":"mysite/ionic2/sumitdemo/quotes/wp-json/wp/v2/posts"}],"about":[{"href":"mysite/ionic2/sumitdemo/quotes/wp-json/wp/v2/types/post"}],"author":[{"embeddable":true,"href":"mysite/ionic2/sumitdemo/quotes/wp-json/wp/v2/users/2"}],"replies":[{"embeddable":true,"href":"mysite/ionic2/sumitdemo/quotes/wp-json/wp/v2/comments?post=10"}],"version-history":[{"href":"mysite/ionic2/sumitdemo/quotes/wp-json/wp/v2/posts/10/revisions"}],"wp:attachment":[{"href":"mysite/ionic2/sumitdemo/quotes/wp-json/wp/v2/media?parent=10"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"mysite/ionic2/sumitdemo/quotes/wp-json/wp/v2/categories?post=10"},{"taxonomy":"post_tag","embeddable":true,"href":"mysite/ionic2/sumitdemo/quotes/wp-json/wp/v2/tags?post=10"}],"curies":[{"name":"wp","href":"https://api.w.org/{rel}","templated":true}]}},{"id":8,"date":"2017-08-21T05:32:05","date_gmt":"2017-08-21T05:32:05","guid":{"rendered":"mysite/ionic2/sumitdemo/quotes/?p=8"},"modified":"2017-08-21T05:45:01","modified_gmt":"2017-08-21T05:45:01","slug":"all-birds-find-shelter-during-a-rain","status":"publish","type":"post","link":"mysite/ionic2/sumitdemo/quotes/all-birds-find-shelter-during-a-rain/","title":{"rendered":"All Birds find shelter during a rain"},"content":{"rendered":"<p>“All Birds find shelter during a rain. But Eagle avoids rain by flying above the Clouds.” </p>\n","protected":false},"excerpt":{"rendered":"<p>“All Birds find shelter during a rain. But Eagle avoids rain by flying above the Clouds.”</p>

What does console.log(data) output?

This is output

{"id":10,"date":"2017-08-21T05:32:33","date_gmt":"2017-08-21T05:32:33","guid":{"rendered":"mysite/ionic2/sumitdemo/quotes/?p=10"},"modified":"2017-08-21T05:45:11","modified_gmt":"2017-08-21T05:45:11","slug":"man-needs-difficulties","status":"publish","type":"post","link":"mysite/ionic2/sumitdemo/quotes/man-needs-difficulties/","title":{"rendered":"Man needs difficulties"},"content":{"rendered":"<p>“Man needs difficulties in life because they are necessary to enjoy the success.” </p>\n","protected":false},"excerpt":{"rendered":"<p>“Man needs difficulties in life because they are necessary to enjoy the success.”</p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"quote","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"mysite/ionic2/sumitdemo/quotes/wp-json/wp/v2/posts/10"}],"collection":[{"href":"mysite/ionic2/sumitdemo/quotes/wp-json/wp/v2/posts"}],"about":[{"href":"mysite/ionic2/sumitdemo/quotes/wp-json/wp/v2/types/post"}],"author":[{"embeddable":true,"href":"mysite/ionic2/sumitdemo/quotes/wp-json/wp/v2/users/2"}],"replies":[{"embeddable":true,"href":"mysite/ionic2/sumitdemo/quotes/wp-json/wp/v2/comments?post=10"}],"version-history":[{"href":"mysite/ionic2/sumitdemo/quotes/wp-json/wp/v2/posts/10/revisions"}],"wp:attachment":[{"href":"mysite/ionic2/sumitdemo/quotes/wp-json/wp/v2/media?parent=10"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"mysite/ionic2/sumitdemo/quotes/wp-json/wp/v2/categories?post=10"},{"taxonomy":"post_tag","embeddable":true,"href":"mysite/ionic2/sumitdemo/quotes/wp-json/wp/v2/tags?post=10"}],"curies":[{"name":"wp","href":"https://api.w.org/{rel}","templated":true}]}},{"id":8,"date":"2017-08-21T05:32:05","date_gmt":"2017-08-21T05:32:05","guid":{"rendered":"mysite/ionic2/sumitdemo/quotes/?p=8"},"modified":"2017-08-21T05:45:01","modified_gmt":"2017-08-21T05:45:01","slug":"all-birds-find-shelter-during-a-rain","status":"publish","type":"post","link":"mysite/ionic2/sumitdemo/quotes/all-birds-find-shelter-during-a-rain/","title":{"rendered":"All Birds find shelter during a rain"},"content":{"rendered":"<p>“All Birds find shelter during a rain. But Eagle avoids rain by flying above the Clouds.” </p>\n","protected":false},"excerpt":{"rendered":"<p>“All Birds find shelter during a rain. But Eagle avoids rain by flying above the Clouds.”</p>

That is not valid JSON. So you backend server is responding with invalid data.

Please see the below screenshot

So what you posted above was not the truth.

What do you see when you close the 0 node?

My current guess is that it actually returns a list of things.

Yes Its returning list of things, Actually I want to show specific category’s all posts. One category have 3-4 posts

Then why do you post one of those items, and not the complete list?
Why are you handling the list of things in you code as if it was one thing?

No idea what you mean by that.

Thank you for your reply, you gave your valuable time, I have fixed the issue.

Please share the code, so that future readers of this topic also can learn something. Thanks.

public items: any; replace by public items =[];

it’s working fine for me now all posts are showing form a specific category