Req #69936 [Opn]: enhancement to json_decode -- an option to keep duplicate keys in an array

From: Date: Fri, 26 Jun 2015 01:47:39 +0000
Subject: Req #69936 [Opn]: enhancement to json_decode -- an option to keep duplicate keys in an array
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-193898@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69936&edit=1

 ID:                 69936
 Updated by:         requinix@php.net
 Reported by:        floriparob at gmail dot com
 Summary:            enhancement to json_decode -- an option to keep
                     duplicate keys in an array
 Status:             Open
 Type:               Feature/Change Request
 Package:            JSON related
 Operating System:   Debian stretch/sid
 PHP Version:        5.6.10
 Block user comment: N
 Private report:     N

 New Comment:

That's not possible: arrays can't have duplicate keys.

What if it decoded into an array of values? Like {a:1,a:2} decoded to [a=>[1,2]]?


Previous Comments:
------------------------------------------------------------------------
[2015-06-26 01:42:00] floriparob at gmail dot com

Description:
------------
Using json_decode to turn a JSON string into an associative array. If it finds duplicate key:value
pairs it drops the duplicate.
It would be handy to have an option to keep or not to keep these duplicates.



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=69936&edit=1


Thread (4 messages)

« previous php.bugs (#193898) next »