What does the "jsonObject" mean in DeviceQueue post API?

I want to add a downlink payload to the network-server device queue, so I tried the post method of DeviceQueue in LoRa App REST API web page. I copied the example value of post body and changed some fields:

{
  "confirmed": true,
  "data": "0203",
  "devEUI": "47AB41F2002A0046",
  "fPort": 8,
  "jsonObject":"{"Data":[1,2,3]}",
  "reference":"null"
}

However, I got the response code of 400 and this error:

{
  "error": "invalid character 'D' after object key:value pair",
  "code": 3
}

The “jsonObject” can’t be any value ? Then how should it be evaluated ?

The following is the screenshot:

As the jsonObject key expects a string, you need to escape the value, thus:

"jsonObject":"{\"Data\":[1,2,3]}",

When you have setup a JS codec, this object is passed to the encoder function and it is up to the this function how to encode this to an array of bytes.

I had a try as

{
  "confirmed": true,
  "data": "AQI=",
  "devEUI": "47ab41f2002a0046",
  "fPort": 28,
  "jsonObject":"{\"Data\":[1,2,3]}"
  "reference":"qwer"
}

I still got an error:

{
  "error": "invalid character '\"' after object key:value pair",
  "code": 3
}

Your JSON is invalid as you’re missing a comma at the end of the jsonObject line.

The correct payload is:

{
  "confirmed": true,
  "data": "AQI=",
  "devEUI": "47ab41f2002a0046",
  "fPort": 28,
  "jsonObject":"{\"Data\":[1,2,3]}",
  "reference":"qwer"
}

Thanks!
It was most careless of me:joy:

Hello.

What should I install on the server or what should I configure in chirpstack to encode / decode the json object and avoid this error message?

You need to choose right way for codec in device profile

  1. write own custom javascript codec functions
  2. or if you endnode device use the cayenne low power payload format choose Cayenne LPP

@brocaar
can you please give detail about reference parameter?

changelog:
The reference field has been removed to simplify the downlink queue handling.

Correct me if i am wrong

Thanks.
This is my settings

[quote=“JoseR, post:3, topic:3706”]
{
“deviceQueueItem”: {
“confirmed”: true,
“data”: “AQI=”,
“devEUI”: “47ab41f2002a0046”,
“fCnt”: 0,
“fPort”: 1,
“jsonObject”: “{“Data”:[1,2,3]}”
}
}
[/quote].

To send messages to devices or nodes, is it necessary to configure a database in postgres?
As this guide indicates: https://www.chirpstack.io/application-server/integrate/sending-receiving/postgresql/

this is not necessary, if don’t want to store up/down message history.

Thanks eugenev

That´s perfect to teste, have you complete the encode function on chirpstack?

Have you make the encode function on payload chirpstack?