@@ -817,17 +817,24 @@ def _compare_lists(self, path, src, dst):
817817 self ._item_added (path , key , dst [key ])
818818
819819 def _compare_values (self , path , key , src , dst ):
820- if src == dst :
821- return
822-
823- elif isinstance (src , MutableMapping ) and \
820+ if isinstance (src , MutableMapping ) and \
824821 isinstance (dst , MutableMapping ):
825822 self ._compare_dicts (_path_join (path , key ), src , dst )
826823
827824 elif isinstance (src , MutableSequence ) and \
828825 isinstance (dst , MutableSequence ):
829826 self ._compare_lists (_path_join (path , key ), src , dst )
830827
828+ # To ensure we catch changes to JSON, we can't rely on a simple
829+ # src == dst, or it would not recognize the difference between
830+ # 1 and True, among other things. Using json.dumps is the most
831+ # fool-proof way to ensure we catch type changes that matter to JSON
832+ # and ignore those that don't. The performance of this could be
833+ # improved by doing more direct type checks, but we'd need to be
834+ # careful to accept type changes that don't matter when JSONified.
835+ elif json .dumps (src ) == json .dumps (dst ):
836+ return
837+
831838 else :
832839 self ._item_replaced (path , key , dst )
833840
0 commit comments