HomePhabricator

Add an optional mode for `PhutilJSONParser` to detect duplicate keys

Description

Add an optional mode for PhutilJSONParser to detect duplicate keys

Summary:
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.

Test Plan: Wrote and executed unit tests.

Reviewers: Blessed Reviewers, epriestley

Reviewed By: Blessed Reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5297

Differential Revision: https://secure.phabricator.com/D9627

Event Timeline