-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjsontransform.py
92 lines (44 loc) · 1.3 KB
/
jsontransform.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Simple JSON transform routine
import json
import pprint
with open('json-raw-in.json') as json_data:
ping = json.load(json_data)
json_data.close()
with open('json-transform-to.json') as json_data:
postform = json.load(json_data)
json_data.close()
print('inboundjson')
print(ping)
print('\nMaps to new json')
print(postform)
x=type(postform)
print('Type of loaded JSON objects is',x)
'''
{
"device": "nydc-pod-h-n5k-a-mgmt [Cisco Device]",
"group": "NYDC-NonProd Data Center",
"lastvalue": "820 Mbit/s",
"lastvalue_raw": 102559336.0512,
"message": "<div class=\"status\">OK<div class=\"moreicon\"></div></div>",
"message_raw": "OK",
"objid": 10003,
"priority": 3,
"probe": "Probe on AWS : 10.93.152.104",
"sensor": "(436289536) POD-H-A-FEX161_Uplink1 Traffic",
"status": "Up",
"status_raw": 3
{
"applicationIdentifier":"NonProd Data Center",
"applicationCodes":[
"nydc-pod-h...",
],
"name":"NTS Equity",
"status":"WARNING",
"dashboardLink":"http://stage:13080/dashboard",
"nextUpdateSeconds":"60",
"messages":[
"Compliance calls are slow",
"Load balancer instance is offline"
]
}
'''