I'm no expert, but you will loose some item in your array (every non serializable like functions), it will fail on non utf8 encoded string, throws on circular reference and order will matter.
Overall, JSON is not a great way to compare complex object or array.
Agreed, it's not great in most cases. However, sometimes it is just practical from a dev productivity point of view:
If you use it, wrap it in your own compareXYZ() util-function, so you can
a) adjust it later
b) see that function in your profiler pop up
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.