{"action":"created","issue":{"url":"https://api.github.com/repos/boris317/JsonWeb/issues/11","repository_url":"https://api.github.com/repos/boris317/JsonWeb","labels_url":"https://api.github.com/repos/boris317/JsonWeb/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/boris317/JsonWeb/issues/11/comments","events_url":"https://api.github.com/repos/boris317/JsonWeb/issues/11/events","html_url":"https://github.com/boris317/JsonWeb/pull/11","id":131899919,"number":11,"title":"OrderedDict compatible","user":{"login":"team-python","id":7552778,"avatar_url":"https://avatars.githubusercontent.com/u/7552778?v=3","gravatar_id":"","url":"https://api.github.com/users/team-python","html_url":"https://github.com/team-python","followers_url":"https://api.github.com/users/team-python/followers","following_url":"https://api.github.com/users/team-python/following{/other_user}","gists_url":"https://api.github.com/users/team-python/gists{/gist_id}","starred_url":"https://api.github.com/users/team-python/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/team-python/subscriptions","organizations_url":"https://api.github.com/users/team-python/orgs","repos_url":"https://api.github.com/users/team-python/repos","events_url":"https://api.github.com/users/team-python/events{/privacy}","received_events_url":"https://api.github.com/users/team-python/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-06T21:08:46Z","updated_at":"2016-02-08T02:13:40Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/boris317/JsonWeb/pulls/11","html_url":"https://github.com/boris317/JsonWeb/pull/11","diff_url":"https://github.com/boris317/JsonWeb/pull/11.diff","patch_url":"https://github.com/boris317/JsonWeb/pull/11.patch"},"body":"It seems there are 3 changes here.\r\nFirstly, my editor (atom) likes to delete training whitespace at the end of lines. Annoying and distracting, since it creates a lot of lines with changes that are not really changes. My diff engine did not even highlight these lines as changed.\r\n\r\nSecondly, I moved to relative imports as this give flexibility where the package is in the tree.\r\n\r\nThirdly, and most significantly, I added code to allow working with 'OrderedDict' which allow maintaining the order of key value pairs.  So dictionaries which are not classes can be returned as OrderedDicts when passing method to 'object_hook_pair'.  Previously any use of 'object_hook_pairs' blocked object decoding.  I modified the code to still work with object hook_pairs.\r\n\r\nHope you like the addition."},"comment":{"url":"https://api.github.com/repos/boris317/JsonWeb/issues/comments/181161542","html_url":"https://github.com/boris317/JsonWeb/pull/11#issuecomment-181161542","issue_url":"https://api.github.com/repos/boris317/JsonWeb/issues/11","id":181161542,"user":{"login":"team-python","id":7552778,"avatar_url":"https://avatars.githubusercontent.com/u/7552778?v=3","gravatar_id":"","url":"https://api.github.com/users/team-python","html_url":"https://github.com/team-python","followers_url":"https://api.github.com/users/team-python/followers","following_url":"https://api.github.com/users/team-python/following{/other_user}","gists_url":"https://api.github.com/users/team-python/gists{/gist_id}","starred_url":"https://api.github.com/users/team-python/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/team-python/subscriptions","organizations_url":"https://api.github.com/users/team-python/orgs","repos_url":"https://api.github.com/users/team-python/repos","events_url":"https://api.github.com/users/team-python/events{/privacy}","received_events_url":"https://api.github.com/users/team-python/received_events","type":"User","site_admin":false},"created_at":"2016-02-08T02:13:40Z","updated_at":"2016-02-08T02:13:40Z","body":"This was a first communication and before making things thorough was waiting for feedback.\r\n\r\nSince I take it you are happy with moving to relative imports, as you suggest I will look to complete the task.\r\n\r\nThe 'base_hook' is to allow for code which already has a use case for either 'object_hook' or 'object_pairs_hook' and one of these is already present in the call to be changed to use this library in place of the standard json library.\r\n\r\nThe result is that the previous 'object_hook' (or 'base_hook') drops in priority below the JsonWeb objects.  So once JsonWeb library decides the object is not to be processed within this library, then whatever object hook was previously used with then be called.\r\n\r\nMy own case was 'OrderedDict()' being called using 'object_pairs_hook'.  \r\n\r\ndecode.loader(jsonString  ,object_pairs_hook=OrderedDict)\r\n\r\nwill now perform decode objects with __type__ as before, but will produce OrderedDict objects for those not converted into an object by JsonWeb.  None that the original object_pairs_hook ranks in priority below JsonWeb and is only called after JsonWeb code determines this object should not be processed by JsonWeb.\r\n\r\nBefore the change, the result of the call above is to disable JsonWeb decoding objects completely and leave all as OrderedDicts.\r\nHope this helps.\r\n\r\nIf you agree with the concept, which leaves unchanged where there was no previous 'object_hook' or 'object_pairs_hook' parameter,  but produces a useful result in cases where they are present, then I will look to add unit tests.\r\n\r\nI have done a quick update for the two style points you noted, but time constraints mean I will be slower on the other points. "}}