Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87150 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40478 invoked from network); 13 Jul 2015 15:12:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Jul 2015 15:12:58 -0000 Authentication-Results: pb1.pair.com header.from=dean.eigenmann@icloud.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dean.eigenmann@icloud.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain icloud.com designates 17.158.42.246 as permitted sender) X-PHP-List-Original-Sender: dean.eigenmann@icloud.com X-Host-Fingerprint: 17.158.42.246 nk11p07mm-asmtpout001.mac.com Solaris 10 1203 Received: from [17.158.42.246] ([17.158.42.246:65428] helo=nk11p07mm-asmtp001.mac.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 45/FA-43998-775D3A55 for ; Mon, 13 Jul 2015 11:12:56 -0400 Received: from [10.177.176.52] (unknown [213.55.184.199]) by nk11p07mm-asmtp001.mac.com (Oracle Communications Messaging Server 7.0.5.35.0 64bit (built Mar 31 2015)) with ESMTPSA id <0NRF000X9M8UY510@nk11p07mm-asmtp001.mac.com> for internals@lists.php.net; Mon, 13 Jul 2015 15:12:35 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.14.151,1.0.33,0.0.0000 definitions=2015-07-13_09:2015-07-13,2015-07-13,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1412110000 definitions=main-1507130215 References: MIME-version: 1.0 (1.0) In-reply-to: Content-type: multipart/alternative; boundary=Apple-Mail-BD4E37EE-6DC5-4A6A-8ED0-545EEE836897 Content-transfer-encoding: 7bit Message-ID: Cc: "guilhermeblanco@gmail.com" , "sbj.ml.read@gmail.com" , "internals@lists.php.net" X-Mailer: iPhone Mail (12H143) Date: Mon, 13 Jul 2015 17:12:29 +0200 To: Ryan Pallas Subject: Re: [PHP-DEV] JsonSerializable New Interface method Proposal From: dean.eigenmann@icloud.com (Dean Eigenmann) --Apple-Mail-BD4E37EE-6DC5-4A6A-8ED0-545EEE836897 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Ryan, I think the usage of this won't support multidimensional arrays. However in the decode function,=20 You could specify Foreach ($arr['permission'] as $permission) { $this->permissions[] =3D (permission) json_decode($permission); } Sent from my iPhone On 13 Jul 2015, at 17:03, Ryan Pallas wrote: >>=20 >>>> Ive just opened a new RFC https://wiki.php.net/rfc/jsonserializable >>>> regarding Json to Object unserialization. > I like the idea, but how do you handle complex json notations, that may co= ntain arrays of objects? Say: > { > "id": 123 > "type": "user", > "name": "derokorian" > "permissions": [{ > "id": 1, > "value": "create" > },{ > "id": 2, > "value": "edit" > }] > } >=20 > Would this new function give me objects of type Permission in the permissi= ons array, or would this solution only be a single level deep and therefore r= eturn an array of StdClass? I see no way to be able to tell this to the deco= der in the User class because php does not support typed arrays. --Apple-Mail-BD4E37EE-6DC5-4A6A-8ED0-545EEE836897--