[OpenSIPS-Users] Unable to parse JSON

Hamid Hashmi hamid2kviii at hotmail.com
Tue Jul 30 03:40:03 EDT 2019


Below is the JSON response received in an async rest post request (mod rest_client).

 xlog("L_INFO","[$fU $tU $ci $rm] PUSH Server responded with $var(rcode):$json(response)");

{
  "error": null,
  "payload": {
    "results": [
      {
        "error": {
          "code": "messaging/registration-token-not-registered",
          "message": "The provided registration token is not registered. A previously valid registration token can be unregistered for a variety of reasons. See the error documentation for more details. Remove this registration token and stop using it to send messages."
        }
      }
    ],
    "canonicalRegistrationTokenCount": 0,
    "failureCount": 1,
    "successCount": 0,
    "multicastId": 4814925980047675000
  }
}

But when I try to print the following line

xlog("L_INFO","[$fU $tU $ci $rm] PUSH Server responded with $var(rcode) with Failure Count: $json(response/payload/failureCount)");

it gives me a NULL Value. What am I doing wrong?

version: opensips 2.4.6 (x86_64/linux)
flags: STATS: On, DISABLE_NAGLE, USE_MCAST, SHM_MMAP, PKG_MALLOC, F_MALLOC, FAST_LOCK-ADAPTIVE_WAIT
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535
poll method support: poll, epoll, sigio_rt, select.
git revision: edef893c5
main.c compiled on 11:29:33 Jul 29 2019 with gcc 4.8.5

[root at sip-3 opc]# rpm -qa | grep json
json-c-devel-0.11-4.el7_0.x86_64
libfastjson-0.99.4-3.el7.x86_64
python-jsonpatch-1.2-4.el7.noarch
json-c-0.11-4.el7_0.x86_64
json-glib-devel-1.4.2-2.el7.x86_64
python-jsonpointer-1.9-2.el7.noarch
json-glib-1.4.2-2.el7.x86_64


Regards


Hamid R. Hashmi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20190730/fd91a27f/attachment-0001.html>


More information about the Users mailing list