0

I am making an API request using http.get

this.http.get('https://api.domain.com/test', {headers:headers}).map(res => res.json()).subscribe(data => {
    console.log('test', data);                      
}); 

The raw json response is:

{"1":{"name":"One"},"2":{"name":"Two"},"3":{"name":"Three"},"4":{"name":"Four"},"5":{"name":"Five"}}

If I then change the response of the API and set the order of the keys to be 3,2,1,4,5 then console.log still shows the data in the order 1, 2, 3, 4, 5

It seems like either the map or subscribe calls are changing the response and sorting by key. I would like the value of data to be exactly what I get back from my API without being re-sorted. Is this possible?

Chris
  • 4,672
  • 13
  • 52
  • 93

0 Answers0