Chirpstack JSON Order

Hi all,
i am currently having a problem with the JSON order of chirpstack.

Every time the JSON is sent, the order changes in a random way.

In the first message, the object looks like that:

  • Message_type:1
  • PH1_SOIL:“0.85”
  • Interrupt_flag:0
  • Bat:“3.375 V”
  • TempC_DS18B20:“0.00 °C”
  • TEMP_SOIL:“28.00”

In the second message it looks like that.

  • Interrupt_flag:0
  • Message_type:1
  • TempC_DS18B20:“0.00 °C”
  • PH1_SOIL:“0.98”
  • TEMP_SOIL:“24.80”
  • Bat:“3.378 V”

Is it possible to have the exact same order every message?

Topic was discussed in here.

2 Likes

To summarize: an object (described by JSON in our case) is unordered, unlike an array.

So we should never rely on the order of an object when parsing it.

2 Likes