简体   繁体   中英

Response map sort order with angular2

From my server I return json

{
  "something":"a",
  "map": {
          "rowid":1,
          "a":1,
          "b":2,
          ..
          "r":2
          }
  }

When I use:

return this.authHttp.put(queryUrl, bodyString, this.requestsOptions).map(res=> res.json)

It returns the (observable json) object in sorted order:

{
  "something":"a",
  "map": {

          "a":1,
          "b":2,
          ..
          "r":2,
          "rowid":1,
          }
  }`

Is there any way to control the order in which json() reads the inner map? So that the response ordering is preserved?

(Without having to map to a new object type if possible)

有时响应的顺序已经保留,但 console.log 将地图按字母顺序排序

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM