So, my expected json response from my product information api looks like this:
{
    _productDepartment : null,
    _productClass : null,
    _productMaterial : null,
    _productStyle : null,
    _productDetails :
    {
        _productSkuKey : 800,
        _description : "Product Description",
        _collection : "Collection1",
        _department : 200,
        _productSize : "Size1",
        _productClass : 45,
        _productStyle : 1234,
        _material : "Product Material",
        _price : 100.00,
        _mediaFileName : "XYZ"
    },
    _products : null,
    _errorDetails :
    {
        _message : "success",
        _status : 200
    }
}
For this specific api call, I'm mostly interested in the productDetails information and errorStatus. I want to create a productDetails object based on the json response above, so I created two interfaces, one for product and one for productdetails.
Here are my interfaces:
//product.ts
import { IProductDetails } from './productDetails';
export interface IProduct {
    productDepartment: string;
    productClass: string;
    productMaterial: string;
    productStyle: string;
    productDetails: IProductDetails;
    products: null;
    errorDetails: string;
}
//productDetails.ts
export interface IProductDetails {
    productSkuKey: number;
    description: string;
    collection: string;
    department: number;
    productSize: string;
    productClass: string;
    productStyle: number;
    material: string;
    price: string;
    mediaFileName: string;
}
In one of my services, I have this call:
getProducts(storeId: string, productSKU: string) {
    this.products = this.baseUrl + '/products/' + storeId + '/' + productSKU;
    return this.http.get<IProduct[]>(this.products).catch(this.errorHandler);
  }
and in one of my components, I call the service:
this._transactionService.getProduct('98', '343').subscribe(data => this.products = data._productDetails);
My question is, is this the right approach for making sure the object I use in my code matches the json response data? How does it know to map _productSkuKey with productSkuKey in my interface?