Skip to content

Instantly share code, notes, and snippets.

@deoxxa
Created November 3, 2016 09:54
Show Gist options
  • Save deoxxa/eec665c382ae1de08baff56c59dd74d7 to your computer and use it in GitHub Desktop.
Save deoxxa/eec665c382ae1de08baff56c59dd74d7 to your computer and use it in GitHub Desktop.
{
"Imei": "354678050021708",
"Timestamp": 1477343460116,
"Priority": 0,
"Gps": {
"Longitude": 1508431968,
"Latitude": -323215269,
"Altitude": 135,
"Angle": 82,
"Satellites": 8,
"Speed": 10
},
"EventId": 0,
"TotalCount": 9,
"Metrics": {
"Size8": [
{
"K": 1,
"V": 0
},
{
"K": 69,
"V": 1
},
{
"K": 240,
"V": 0
},
{
"K": 21,
"V": 4
}
],
"Size16": [
{
"K": 9,
"V": 178
},
{
"K": 66,
"V": 11907
},
{
"K": 24,
"V": 27
}
],
"Size32": [
{
"K": 241,
"V": 50501
}
],
"Size64": [
{
"K": 78,
"V": 0
}
]
}
}
{
"Imei": "354678050021701",
"Timestamp": 1477343459932,
"Priority": 0,
"Gps": {
"Longitude": 1508433748,
"Latitude": -323219703,
"Altitude": 150,
"Angle": 77,
"Satellites": 15,
"Speed": 17
},
"EventId": 0,
"TotalCount": 9,
"Metrics": {
"Size8": [
{
"K": 1,
"V": 0
},
{
"K": 69,
"V": 0
},
{
"K": 240,
"V": 1
},
{
"K": 21,
"V": 4
}
],
"Size16": [
{
"K": 9,
"V": 178
},
{
"K": 66,
"V": 15525
},
{
"K": 24,
"V": 26
}
],
"Size32": [
{
"K": 241,
"V": 50501
}
],
"Size64": [
{
"K": 78,
"V": 0
}
]
}
}
{
"Imei": "354678050021702",
"Timestamp": 1477343459744,
"Priority": 0,
"Gps": {
"Longitude": 1508429090,
"Latitude": -323218343,
"Altitude": 132,
"Angle": 92,
"Satellites": 13,
"Speed": 23
},
"EventId": 0,
"TotalCount": 9,
"Metrics": {
"Size8": [
{
"K": 1,
"V": 1
},
{
"K": 69,
"V": 1
},
{
"K": 240,
"V": 0
},
{
"K": 21,
"V": 4
}
],
"Size16": [
{
"K": 9,
"V": 185
},
{
"K": 66,
"V": 12387
},
{
"K": 24,
"V": 14
}
],
"Size32": [
{
"K": 241,
"V": 50501
}
],
"Size64": [
{
"K": 78,
"V": 0
}
]
}
}
{
"Imei": "354678050021705",
"Timestamp": 1477343459557,
"Priority": 0,
"Gps": {
"Longitude": 1508432950,
"Latitude": -323217422,
"Altitude": 144,
"Angle": 83,
"Satellites": 17,
"Speed": 23
},
"EventId": 0,
"TotalCount": 9,
"Metrics": {
"Size8": [
{
"K": 1,
"V": 1
},
{
"K": 69,
"V": 1
},
{
"K": 240,
"V": 1
},
{
"K": 21,
"V": 4
}
],
"Size16": [
{
"K": 9,
"V": 174
},
{
"K": 66,
"V": 8980
},
{
"K": 24,
"V": 15
}
],
"Size32": [
{
"K": 241,
"V": 50501
}
],
"Size64": [
{
"K": 78,
"V": 0
}
]
}
}
{
"Imei": "354678050021704",
"Timestamp": 1477343459371,
"Priority": 0,
"Gps": {
"Longitude": 1508431421,
"Latitude": -323220238,
"Altitude": 134,
"Angle": 82,
"Satellites": 13,
"Speed": 15
},
"EventId": 0,
"TotalCount": 9,
"Metrics": {
"Size8": [
{
"K": 1,
"V": 1
},
{
"K": 69,
"V": 0
},
{
"K": 240,
"V": 1
},
{
"K": 21,
"V": 4
}
],
"Size16": [
{
"K": 9,
"V": 179
},
{
"K": 66,
"V": 17451
},
{
"K": 24,
"V": 25
}
],
"Size32": [
{
"K": 241,
"V": 50501
}
],
"Size64": [
{
"K": 78,
"V": 0
}
]
}
}
{
"Imei": "354678050021709",
"Timestamp": 1477343459184,
"Priority": 0,
"Gps": {
"Longitude": 1508429719,
"Latitude": -323221750,
"Altitude": 137,
"Angle": 73,
"Satellites": 8,
"Speed": 24
},
"EventId": 0,
"TotalCount": 9,
"Metrics": {
"Size8": [
{
"K": 1,
"V": 0
},
{
"K": 69,
"V": 0
},
{
"K": 240,
"V": 1
},
{
"K": 21,
"V": 4
}
],
"Size16": [
{
"K": 9,
"V": 180
},
{
"K": 66,
"V": 15205
},
{
"K": 24,
"V": 28
}
],
"Size32": [
{
"K": 241,
"V": 50501
}
],
"Size64": [
{
"K": 78,
"V": 0
}
]
}
}
{
"Imei": "354678050021703",
"Timestamp": 1477343459003,
"Priority": 0,
"Gps": {
"Longitude": 1508428596,
"Latitude": -323218319,
"Altitude": 147,
"Angle": 72,
"Satellites": 4,
"Speed": 19
},
"EventId": 0,
"TotalCount": 9,
"Metrics": {
"Size8": [
{
"K": 1,
"V": 1
},
{
"K": 69,
"V": 0
},
{
"K": 240,
"V": 1
},
{
"K": 21,
"V": 4
}
],
"Size16": [
{
"K": 9,
"V": 181
},
{
"K": 66,
"V": 14354
},
{
"K": 24,
"V": 18
}
],
"Size32": [
{
"K": 241,
"V": 50501
}
],
"Size64": [
{
"K": 78,
"V": 0
}
]
}
}
{
"Imei": "354678050021702",
"Timestamp": 1477343458815,
"Priority": 0,
"Gps": {
"Longitude": 1508435832,
"Latitude": -323215024,
"Altitude": 141,
"Angle": 87,
"Satellites": 6,
"Speed": 20
},
"EventId": 0,
"TotalCount": 9,
"Metrics": {
"Size8": [
{
"K": 1,
"V": 1
},
{
"K": 69,
"V": 1
},
{
"K": 240,
"V": 0
},
{
"K": 21,
"V": 4
}
],
"Size16": [
{
"K": 9,
"V": 186
},
{
"K": 66,
"V": 10224
},
{
"K": 24,
"V": 26
}
],
"Size32": [
{
"K": 241,
"V": 50501
}
],
"Size64": [
{
"K": 78,
"V": 0
}
]
}
}
{
"Imei": "354678050021707",
"Timestamp": 1477343458625,
"Priority": 0,
"Gps": {
"Longitude": 1508435167,
"Latitude": -323219716,
"Altitude": 138,
"Angle": 82,
"Satellites": 4,
"Speed": 24
},
"EventId": 0,
"TotalCount": 9,
"Metrics": {
"Size8": [
{
"K": 1,
"V": 1
},
{
"K": 69,
"V": 1
},
{
"K": 240,
"V": 0
},
{
"K": 21,
"V": 4
}
],
"Size16": [
{
"K": 9,
"V": 181
},
{
"K": 66,
"V": 15275
},
{
"K": 24,
"V": 27
}
],
"Size32": [
{
"K": 241,
"V": 50501
}
],
"Size64": [
{
"K": 78,
"V": 0
}
]
}
}
{
"Imei": "354678050021702",
"Timestamp": 1477343458435,
"Priority": 0,
"Gps": {
"Longitude": 1508432622,
"Latitude": -323221403,
"Altitude": 139,
"Angle": 77,
"Satellites": 21,
"Speed": 12
},
"EventId": 0,
"TotalCount": 9,
"Metrics": {
"Size8": [
{
"K": 1,
"V": 1
},
{
"K": 69,
"V": 0
},
{
"K": 240,
"V": 1
},
{
"K": 21,
"V": 4
}
],
"Size16": [
{
"K": 9,
"V": 192
},
{
"K": 66,
"V": 9809
},
{
"K": 24,
"V": 20
}
],
"Size32": [
{
"K": 241,
"V": 50501
}
],
"Size64": [
{
"K": 78,
"V": 0
}
]
}
}
{
"Imei": "354678050021708",
"Timestamp": 1477343460116,
"Priority": 0,
"Gps": {
"Longitude": 1508431968,
"Latitude": -323215269,
"Altitude": 135,
"Angle": 82,
"Satellites": 8,
"Speed": 10
},
"EventId": 0,
"TotalCount": 9,
"All": {
"9": 178,
"66": 11907,
"24": 27,
"241": 50501,
"78": 0,
"1": 0,
"69": 1,
"240": 0,
"21": 4
}
}
{
"Imei": "354678050021701",
"Timestamp": 1477343459932,
"Priority": 0,
"Gps": {
"Longitude": 1508433748,
"Latitude": -323219703,
"Altitude": 150,
"Angle": 77,
"Satellites": 15,
"Speed": 17
},
"EventId": 0,
"TotalCount": 9,
"All": {
"9": 178,
"66": 15525,
"24": 26,
"241": 50501,
"78": 0,
"1": 0,
"69": 0,
"240": 1,
"21": 4
}
}
{
"Imei": "354678050021702",
"Timestamp": 1477343459744,
"Priority": 0,
"Gps": {
"Longitude": 1508429090,
"Latitude": -323218343,
"Altitude": 132,
"Angle": 92,
"Satellites": 13,
"Speed": 23
},
"EventId": 0,
"TotalCount": 9,
"All": {
"9": 185,
"66": 12387,
"24": 14,
"241": 50501,
"78": 0,
"1": 1,
"69": 1,
"240": 0,
"21": 4
}
}
{
"Imei": "354678050021705",
"Timestamp": 1477343459557,
"Priority": 0,
"Gps": {
"Longitude": 1508432950,
"Latitude": -323217422,
"Altitude": 144,
"Angle": 83,
"Satellites": 17,
"Speed": 23
},
"EventId": 0,
"TotalCount": 9,
"All": {
"9": 174,
"66": 8980,
"24": 15,
"241": 50501,
"78": 0,
"1": 1,
"69": 1,
"240": 1,
"21": 4
}
}
{
"Imei": "354678050021704",
"Timestamp": 1477343459371,
"Priority": 0,
"Gps": {
"Longitude": 1508431421,
"Latitude": -323220238,
"Altitude": 134,
"Angle": 82,
"Satellites": 13,
"Speed": 15
},
"EventId": 0,
"TotalCount": 9,
"All": {
"9": 179,
"66": 17451,
"24": 25,
"241": 50501,
"78": 0,
"1": 1,
"69": 0,
"240": 1,
"21": 4
}
}
{
"Imei": "354678050021709",
"Timestamp": 1477343459184,
"Priority": 0,
"Gps": {
"Longitude": 1508429719,
"Latitude": -323221750,
"Altitude": 137,
"Angle": 73,
"Satellites": 8,
"Speed": 24
},
"EventId": 0,
"TotalCount": 9,
"All": {
"9": 180,
"66": 15205,
"24": 28,
"241": 50501,
"78": 0,
"1": 0,
"69": 0,
"240": 1,
"21": 4
}
}
{
"Imei": "354678050021703",
"Timestamp": 1477343459003,
"Priority": 0,
"Gps": {
"Longitude": 1508428596,
"Latitude": -323218319,
"Altitude": 147,
"Angle": 72,
"Satellites": 4,
"Speed": 19
},
"EventId": 0,
"TotalCount": 9,
"All": {
"9": 181,
"66": 14354,
"24": 18,
"241": 50501,
"78": 0,
"1": 1,
"69": 0,
"240": 1,
"21": 4
}
}
{
"Imei": "354678050021702",
"Timestamp": 1477343458815,
"Priority": 0,
"Gps": {
"Longitude": 1508435832,
"Latitude": -323215024,
"Altitude": 141,
"Angle": 87,
"Satellites": 6,
"Speed": 20
},
"EventId": 0,
"TotalCount": 9,
"All": {
"9": 186,
"66": 10224,
"24": 26,
"241": 50501,
"78": 0,
"1": 1,
"69": 1,
"240": 0,
"21": 4
}
}
{
"Imei": "354678050021707",
"Timestamp": 1477343458625,
"Priority": 0,
"Gps": {
"Longitude": 1508435167,
"Latitude": -323219716,
"Altitude": 138,
"Angle": 82,
"Satellites": 4,
"Speed": 24
},
"EventId": 0,
"TotalCount": 9,
"All": {
"9": 181,
"66": 15275,
"24": 27,
"241": 50501,
"78": 0,
"1": 1,
"69": 1,
"240": 0,
"21": 4
}
}
{
"Imei": "354678050021702",
"Timestamp": 1477343458435,
"Priority": 0,
"Gps": {
"Longitude": 1508432622,
"Latitude": -323221403,
"Altitude": 139,
"Angle": 77,
"Satellites": 21,
"Speed": 12
},
"EventId": 0,
"TotalCount": 9,
"All": {
"9": 192,
"66": 9809,
"24": 20,
"241": 50501,
"78": 0,
"1": 1,
"69": 0,
"240": 1,
"21": 4
}
}
. as $root
| $root + {
All: (
.Metrics
| keys
| reduce .[] as $kind ({}; . + (
$root.Metrics[$kind] | reduce .[] as $item ({}; . + {
($item.K | tostring): $item.V
})
))
)
}
| del(.Metrics)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment