Hi All,

I am currently trying to retrieve the contents of a htable using the JSONRPC-S module over HTTP, however I have observed if a slot contains multiple values, the JSON returned has duplicate keys which could be considered invalid. 

Here are the relevant lines from kamailio.cfg -

event_route[xhttp:request] {
    if ($hu =~ "^/carrier") {
        jsonrpc_exec('{"jsonrpc": "2.0", "method": "htable.dump", "params" : {"htable": "carrier"}, "id": 1}');
        xhttp_reply("200", "OK", "text/html", "$jsonrpl(body)");
    }
}

And the output, showing a slot with two items-


{
"entry": 5,
"size": 2,
"slot": {
"item": {
"name": "carrierA",
"value": "90",
"type": "str"
},
"item": {
"name": "carrierB",
"value": "190",
"type": "str"
}
}
}

And the same from `kamcmd -s unix:/tmp/kamailio_ctl htable.dump carrier` -

{
entry: 5
size: 2
slot: {
item: {
name: carrierA
value: 90
type: str
}
item: {
name: carrierB
value: 190
type: str
}
}
}

Would it be possible to change it to something like the following -

{
    "entry": 5,
    "size": 2,
    "slot": [
        {
            "name": "carrierA",
            "value": "90",
            "type": "str"
        },
        {
            "name": "carrierB",
            "value": "190",
            "type": "str"
        }
    ]
}

Any other suggestions or work arounds would be appreciated, 

Thanks
Matthew