函数抛出错误 [ts] 属性 'json' 在 Angular4 中类型 'Object' 上不存在

Function throws error [ts] Property 'json' does not exist on type 'Object' in Angular4

我在 Angular4 应用程序中工作,我需要使用 API 响应。为此,我放置了下面的函数,它抛出了我标题中的错误。

我参考了一些 Whosebug 帖子,但对我没有任何帮助。

ngOnInit(){
 this.CartdataService.get_Product_Categories().subscribe(
      data => {
        this.dropdownData = data.json();
      });
}

在这一行中我得到了提到的错误

this.dropdownData = data.json();

这些是我的Headers

import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { CartdataService } from '../../services/cartdata.service';
import { HttpClient } from '@angular/common/http';

import { HttpClient } from '@angular/common/http';

在新的 HttpClient 中,您不必将结果解析为 JSON。

只需删除该行,它就会起作用。