0

The response of a request delivers a JSON. The structure of the JSON looks like this:

{
"32": {
    "docKey": "32",
    "outletId": 32,
    "mdngOutlet": {
        "outletBasic": {
            "outletId": 32,
        }
    }
},
"33": {
    "docKey": "32",
    "outletId": 32,
    "mdngOutlet": {
        "outletBasic": {
            "outletId": 32,
        }
    }
},
"34": {
    "docKey": "32",
    "outletId": 32,
    "mdngOutlet": {
        "outletBasic": {
            "outletId": 32,
        }
    }
},
"35": {
    "docKey": "32",
    "outletId": 32,
    "mdngOutlet": {
        "outletBasic": {
            "outletId": 32,
        }
    }
},
}

What does the interface look like? 32, 33, 34, ... seem to act like map. How can you use a map in an interface?

1 Answer 1

1

Typescript interface can have dynamic keys.

interface YourJSON{
    [key: string]: yourObjectInterface
}
Sign up to request clarification or add additional context in comments.

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.