0

I'm trying to parse the following json object in typescript. For alphabets its fine but for numbers its showing compile time error.

{
"36": [{
    "requestId": 64992,
    "requestNumber": "PQ-17-0068112",
    "requestDate": "16-Apr-2017",
    "requestTypeId": 12,

}]

}

this._requestService.getDetails( res.requestId)
                                .subscribe(
                                    response => 
                                    {
                                        let r:any = response;
                                        //This line showing error while for alphabets its fine, for numeric its saying ',' expected
                                        console.log(response.36);
                                    }

                                );

1 Answer 1

2

You can't use dot syntax with key which is number is js. Try

response['36']
Sign up to request clarification or add additional context in comments.

1 Comment

That's what I want. Thanks alot

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.