Fix json encoder compatibility