Hi,
trying to use JSON data instead of parsing them with PHP and storing them into mySQL, but I am stuck with getting "Fields have different lengths".
Below is my data. Can someone help me get this data into table like form?
I am able to get "id", state", but not anything under "stats". I believe it is due the fact that "stats" are not there if "state" is not "connected".
I get "id" as "*.id" and set query as JSONATA.
**************** START DATA *******************
{
"SrtReceivers": [
{},
{
"id": "95.166.22.151:35166->0.0.0.0:20203",
"state": "connected",
"retryCount": 2,
"stats": {}
},
{
"id": "95.166.22.151:57988->0.0.0.0:20204",
"state": "connected",
"retryCount": 2,
"stats": {
"time": 71488923,
"window": {
"flow": 8192,
"congestion": 8192,
"flight": 0
},
"link": {
"rtt": 3.804,
"mbpsBandwidth": 398.88,
"mbpsMaxBandwidth": 1250
},
"recv": {
"packetsReceived": 23226703,
"packetsReceivedRetransmitted": 2351,
"packetsLost": 3025,
"packetsDropped": 0,
"packetsBelated": 949,
"NAKsSent": 1564,
"bytesReceived": 31588316080,
"bytesLost": 4114000,
"bytesDropped": 0,
"mbpsRate": 3.5349
}
}
},
{
"id": "95.166.22.151:54740->0.0.0.0:20205",
"state": "connected",
"retryCount": 2,
"stats": {
"time": 75070998,
"window": {
"flow": 8192,
"congestion": 8192,
"flight": 0
},
"link": {
"rtt": 3.859,
"mbpsBandwidth": 336.6,
"mbpsMaxBandwidth": 1250
},
"recv": {
"packetsReceived": 29920947,
"packetsReceivedRetransmitted": 2667,
"packetsLost": 2886,
"packetsDropped": 0,
"packetsBelated": 951,
"NAKsSent": 1942,
"bytesReceived": 40692487920,
"bytesLost": 3924960,
"bytesDropped": 0,
"mbpsRate": 4.33643
}
}
},
{
"id": "95.166.22.100:52552->0.0.0.0:20207",
"state": "connected",
"retryCount": 4,
"stats": {
"time": 71488980,
"window": {
"flow": 8192,
"congestion": 8192,
"flight": 0
},
"link": {
"rtt": 3.2,
"mbpsBandwidth": 110.628,
"mbpsMaxBandwidth": 1250
},
"recv": {
"packetsReceived": 29797101,
"packetsReceivedRetransmitted": 30389,
"packetsLost": 31692,
"packetsDropped": 0,
"packetsBelated": 8556,
"NAKsSent": 22089,
"bytesReceived": 40524057360,
"bytesLost": 43101120,
"bytesDropped": 0,
"mbpsRate": 4.53486
}
}
},
{
"id": "95.166.22.100:60125->0.0.0.0:20208",
"state": "connected",
"retryCount": 2,
"stats": {
"time": 128933317,
"window": {
"flow": 8192,
"congestion": 8192,
"flight": 0
},
"link": {
"rtt": 3.371,
"mbpsBandwidth": 189.888,
"mbpsMaxBandwidth": 1250
},
"recv": {
"packetsReceived": 51017037,
"packetsReceivedRetransmitted": 59865,
"packetsLost": 63460,
"packetsDropped": 0,
"packetsBelated": 17558,
"NAKsSent": 42658,
"bytesReceived": 69383170320,
"bytesLost": 86305600,
"bytesDropped": 0,
"mbpsRate": 4.30506
}
}
},
{
"id": "95.166.22.151:39395->0.0.0.0:20206",
"state": "connected",
"retryCount": 4,
"stats": {
"time": 30142922,
"window": {
"flow": 8192,
"congestion": 8192,
"flight": 0
},
"link": {
"rtt": 4.027,
"mbpsBandwidth": 232.212,
"mbpsMaxBandwidth": 1000
},
"recv": {
"packetsReceived": 1631449,
"packetsReceivedRetransmitted": 110,
"packetsLost": 98,
"packetsDropped": 0,
"packetsBelated": 23,
"NAKsSent": 88,
"bytesReceived": 2218770640,
"bytesLost": 133280,
"bytesDropped": 0,
"mbpsRate": 0.588867
}
}
}
]
}
**************** END DATA *******************