Please study the following to get you started. It looks like JSON output that 
you are dealing,
which is good. I added a ", to the "body"-line, because I assume that you 
botched that when giving
an example.

```python
#!/usr/bin/env python


import json


output = '''
{
   "error" : {
      "body" : "The requested device is currently not online.",
      "detail" : "Make sure to connect the device",
      "event" : 123456,
      "header" : "Device Unavailable (123456)"
   }
}
'''


# help(json.loads)
parsed = json.loads(output)

if type(parsed) == dict:
    if type(parsed['error']) == dict:
        print("yay!")
```

HTH
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to