0

enter image description here

How to convert this JSON structure to Class

1
  • 1
    what is the question? Commented Jun 11, 2018 at 6:51

2 Answers 2

1

You can use JSON2TS which will automatically create a typescript class for you.

Just paste the JSON and see the corresponding ts file.

Sign up to request clarification or add additional context in comments.

Comments

0

Looking at your screenshot, you can declare it by using this:

declare module namespace {

    export interface Address {
        city?: any;
        area?: any;
        house_No?: any;
        landmark?: any;
        locality?: any;
    }

    export interface Order {
        product_Name: string;
        product_ID: string;
        order_Active: boolean;
        price: string;
        qty: string;
    }

    export interface OrderList {
        address: Address;
        order: Order[];
        order_ID: string;
        timeStamp: number;
        total_Amount: number;
        user_ID: string;
    }

    export interface RootObject {
        orderList: OrderList[];
        orderSize: number;
        status_code: string;
        status_message: string;
    }

}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.