W3C home > Mailing lists > Public > public-linked-json@w3.org > April 2017

Re: Language maps and undefined language

From: Jakob Voß <Jakob.Voss@gbv.de>
Date: Thu, 13 Apr 2017 12:32:20 +0200
To: Gregg Kellogg <gregg@greggkellogg.net>, Robert Sanderson <azaroth42@gmail.com>
CC: Linked JSON <public-linked-json@w3.org>
Message-ID: <23833aa2-1c74-3137-e4bf-b4475499efec@gbv.de>
Hi again,

Rob wrote:

>> Note that we cannot use "", as noted, because PHP does not support
>> empty string as the key of a dictionary... and thus we fallback to
>> using "und”.

"" is a legal object key in JSON and PHP just happens to be one 
programming languages with full support of JSON, so why design JSON-LD 
with focus on a particular choice of implementation in PHP? The language 
can deal with "" keys in JSON data pretty well:

$json = '{"":1}';
$data = json_decode($json, true);
echo $data[""]; # prints '1'

If you prefer PHP objects over PHP arrays, the "" can internally be 
replaces by another special value but that's a personal choice of 
implementation and out of the scope of JSON-LD.

Using "" for non-language strings looks like the cleanest and most 
obvious solution to me.


Jakob Voß <jakob.voss@gbv.de>
Verbundzentrale des GBV (VZG) / Common Library Network
Platz der Goettinger Sieben 1, 37073 Göttingen, Germany
+49 (0)551 39-10242, http://www.gbv.de/
Received on Thursday, 13 April 2017 10:32:50 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:18:49 UTC