Вы пропустили }
в конце ваших данных JSON.
import json
import collections
data = {
"id" : "de",
"Key" : "1234567",
"from" : "test@test.com",
"expires" : "2018-04-25 18:45:48.3166159",
"command" : "method.exec",
"params" : {
"method" : "cmd",
"Key" : "default",
"params" : {
"command" : "testing 23"
}
}}
data_str = json.dumps(data)
result = json.loads(data_str, object_pairs_hook=collections.OrderedDict)
print(result)
Выход:
OrderedDict(
[
('id', 'de'),
('Key', '1234567'),
('from', 'test@test.com'),
('expires', '2018-04-25 18:45:48.3166159'),
('command', 'method.exec'),
('params',
OrderedDict(
[
('method', 'cmd'),
('Key', 'default'),
('params',
OrderedDict(
[
('command', 'testing 23')
]
)
)
]
)
)
]
)