Ref T5297. Change PhutilJSONParser to disallow duplicate keys by default. In addition, add an optional mode to allow duplicate keys. One important caveat here is that PhutilJSONParser will return the first value in the case of a duplicate, whereas json_decode will return the last value.
Depends on D9624.