The goal is to get rid of the special character in the JSON output. In certain situations, special characters may have different meanings, and you just want to pass JSON without using any of them.
Suppose you want to send json inside some XML. You do not want <in there messing with xml. Thus, you simply use the opportunity to get rid of them so as not to create any problems.