Reputation: 397
Python 2.6.6 and all I am doing is receive the message from zmq and json.loads(message). Sorry for all the confusion the json as it is
{"mouhter_id":"one_keert","header":{"header_version":"1","message_type":"one_keert","session_id":"428c0ebd497b9dfcc3170da0d1e0628e","timestamp":1376616699,"src_path":"*/dc/occ1/bell000/lcd_one_mtmt/26866","dst_path":"*/dc/lkjhgvd/lkjhgvd/fegtault/24068"},"payload":{"destHardwareId":"","command":{"id":"bmclmc1","params":{"keylen":"396","key":"AAAAIM0XlJxAEiX6t1KSyuQh+gCnP1Jmu3lkTZvxhiOUogyMAAABDC0tLS0tQkVHSU4gUFVCTElDIEtFWS0tLS0tCk1JR2JNQkFHQnlxR1NNNDlBZ0VHQlN1QkJBQWpBNEdHQUFRQjAxaTZkOG5xVTBnQVBIdHhFMDZqNEI0UDF4TXoKVTVYYy83RnZCVzBtTFI3WlQxRTRxUmw3VEx0OVcwSi85OU5XRzF3NU14Um1oK2dubEJxTTFkNytadU1BNU1NdgpFbmNHcmFpNU1UcHo3elE0cm9CQWZFOVA0czFvM0dRaThSRlVSbFJMdWl2Ym1jempkcVdCYVlEUjNCUU9IOU96ClRWOHFhUnpCN3l0T1NnS09yZzA9Ci0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLQoAAABAg7od/LedQJ8MEBvKQjcBWM2ObdIeSDd/2VygDn0XFwBgUpYiWgum7FE8O51E0Xv3/R6ibvgSPFblqHqLDBNzOgAAAAAAAAAAAAAAAAAAAAAAAAAA"}}}}
I have following JSON and in python I am trying load it so that I can extract the data.
{
"e_id": "1231231",
"header": {
"h_version": "1",
"m_type": "abc",
"s_id": "ffsfsd",
"timestamp": 1376614509,
"s_path": "*/dc/s1/De620/cpmgmt/25804",
"d_path": "*/dc/sfer/sfer/kelt/23642"
},
"payload": {
"dereId": "",
"cond": {
"id": "srcstg1",
"pams": {
"keen": "396",
"ke": "AAAAICZJsxIYABq3JXFRJ7ouZtoLDOLIJBnrw03uASQTiK+nAAABDC0tLS0tQkVHSU4gUFVCTElDIEtFWS0tLS0tCk1JR2JNQkFHQnlxR1NNNDlBZ0VHQlN1QkJBQWpBNEdHQUFRQkR2SEZLNVZZdUg3ZUFMRitLeWhLbWl0TEdEMzAKZmJOakNHYkVNRW1Geld4cFgzZXJ0RjhKSjdjMWZ6cFRhekJGRkpDNW5vR3FycWl2M3VGbGNuMitjUUlCUC9LaQo4V0h4ZVNBVkQ3R2lNTXJHMEVGYTBrOWNucnd5MEtWeU93MEVYcmwyQUNJcXg5enZBV3NLeERhUjRlRzRZVi9jCjB2cVlKcEh1OXNMbE9jWDJJVW89Ci0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLQoAAABA+T4YOvY1ynTIlAUn8xI+/0c+2EAPRFF1uHx8jBP7uuNkb/wnRZl0hJWx6NAOd0kHuh2RdIXXMhXChaEWRNxq6wAAAAAAAAAAAAAAAAAAAAAAAAAA"
}
}
}
}
its throwing me the following error:
raise ValueError(errmsg("Extra data", s, end, len(s)))
ValueError: Extra data: line 1 column 904 - line 1 column 905 (char 904 - 905)
I have used jsonlint to check the validity of the file and it seems to pass that the validation.But I am still getting this error ? have removed all the new line and tabs from the string. anything am missing here ?
Upvotes: 5
Views: 2527
Reputation: 397
there was a null character at the end of the json string which I was getting it from a c++ client so just removed that null char and all works good now.
Upvotes: 1