This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

"modem_info_json_object_encode" performs strange encoding

I am using function "modem_info_json_object_encode" to encode modem info into JSON to send upstream. 

I get the very strange format where you encode dictionary as string (which in my mind is not JSON standard):

"DeviceInfo": {
  "networkInfo": "{\"currentBand\":20,\"supportedBands\":\"\",\"areaCode\":0,\"mccmnc\":\"24001\",\"ipAddress\":\"10.160.105.125\",\"ueMode\":2,\"cellID\":27756832,\"networkMode\":\"LTE-M GPS\"}",
  "simInfo": "{\"uiccMode\":1,\"iccid\":\"8931089318104304850F\",\"imsi\":\"\"}",
  "deviceInfo": "{\"modemFirmware\":\"mfw_nrf9160_1.0.1\",\"batteryVoltage\":4375,\"imei\":\"\",\"board\":\"nrf9160_pca20035\",\"appVersion\":\"v1.0.0-rc1-552-gc9c833b15e6f\",\"appName\":\"ardesco_tracker\"}"
}

I expect:

    "DeviceInfo": {
      "networkInfo": {
        "currentBand": 20,
        "supportedBands": "",
        "areaCode": 0,
        "mccmnc": "24001",
        "ipAddress": "10.160.96.248",
        "ueMode": 2,
        "cellID": 25824012,
        "networkMode": "LTE-M GPS"
      },
      "simInfo": {
        "uiccMode": 1,
        "iccid": "8931089318104305014F",
        "imsi": "204080813516091"
      },
      "deviceInfo": {
        "modemFirmware": "mfw_nrf9160_1.0.1",
        "batteryVoltage": 4375,
        "imei": "352656100826471",
        "board": "nrf9160_pca20035",
        "appVersion": "v1.0.0-rc1-552-gc9c833b15e6f",
        "appName": "ardesco_tracker"
      }
    }

Request: please fix or add another function in future release that perform "standard" endcoding. Alternatively open up the helper functions for external use so I can implement the function myself.

Hardware: Thingy91

Software: nRF Connect SDK, version is master branch as of October 8th 2019.

Parents Reply Children
Related