Fix issue where objects nested in arrays would not have sorted keys

Fixes #45. Similar to #35 but a simpler fix.