Homec4science

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

Authored by Joshua Spence <josh@joshuaspence.com> on Jun 20 2014, 03:57.

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

Details

Committed
Joshua Spence <josh@joshuaspence.com>Jun 20 2014, 03:57
Pushed
aubortMar 17 2017, 12:03
Parents
rPHUf9730519f42c: Throw better exceptions from `PhutilJSONParser`.
Branches
Unknown
Tags
Unknown

Event Timeline

Joshua Spence <josh@joshuaspence.com> committed rPHU384bdaa1cc70: Add an optional mode for `PhutilJSONParser` to detect duplicate keys (authored by Joshua Spence <josh@joshuaspence.com>).Jun 20 2014, 03:57