<p dir="ltr">+1 to not screwing with it.</p>
<div class="gmail_quote">On Mar 14, 2013 2:55 PM, "Mike Jones" <<a href="mailto:Michael.Jones@microsoft.com">Michael.Jones@microsoft.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Let's not screw with the language tag syntax.  Every language has a way to access all JSON object members, even if it may not be the convenient shorthand method that's used for some fields.  I'd rather have programmers use the general-purpose syntax than make the identifiers less understandable.<br>

<br>
                                -- Mike<br>
<br>
-----Original Message-----<br>
From: Nat Sakimura [mailto:<a href="mailto:sakimura@gmail.com">sakimura@gmail.com</a>]<br>
Sent: Thursday, March 14, 2013 11:52 AM<br>
To: Justin Richer<br>
Cc: Mike Jones; <a href="mailto:openid-specs-ab@lists.openid.net">openid-specs-ab@lists.openid.net</a><br>
Subject: Re: [Openid-specs-ab] Language Script Tags<br>
<br>
Yeah.<br>
<br>
Using '_' instead of '#' however means that you will not be able to use '_' in the name, which we use a lot in the current claim syntax.<br>
We could use '$' but that does not alone solve the problem since even '-' cannot be used in the name in Javascript.<br>
So, object syntax is kind of screwed if we wanted to use BCP47 language tags.<br>
<br>
To make it work in Javascript object syntax, we have to at least do the following:<br>
<br>
Decide to use converted BCP47 string: s/-/_/g Use '$' as the delimiter.<br>
<br>
Nat<br>
<br>
2013/3/15 Justin Richer <<a href="mailto:jricher@mitre.org">jricher@mitre.org</a>>:<br>
> Yes, that's the array-style syntax, which works in many languages as well.<br>
> What I was curious about was the object-style syntax, which works for<br>
> every other field that doesn't have the # symbol in it.<br>
><br>
> An alternate syntax would be to just use something other than the #<br>
> symbol to separate the language script tags. "_" would be safest for<br>
> most languages, I believe.<br>
><br>
> But if the answer is that most people are treating their parsed<br>
> elements like arrays instead of objects, then we might want to have<br>
> text in the section of messages that defines the hash-based syntax<br>
> stating the possible issue so that it doesn't surprise others down the<br>
> road. I'm not sure how to do that without going programming-language-specific though.<br>
><br>
>  -- Justin<br>
><br>
><br>
> On 03/14/2013 02:34 PM, Mike Jones wrote:<br>
>><br>
>> If you parse the JSON as follows:<br>
>><br>
>>         var j = JSON.parse(json);<br>
>><br>
>> then I believe that in JavaScript, you can access the "client_name#en-us"<br>
>> field using the syntax:<br>
>><br>
>>         j["client_name#en-us"]<br>
>><br>
>>                                 -- Mike<br>
>><br>
>> -----Original Message-----<br>
>> From: <a href="mailto:openid-specs-ab-bounces@lists.openid.net">openid-specs-ab-bounces@lists.openid.net</a><br>
>> [mailto:<a href="mailto:openid-specs-ab-bounces@lists.openid.net">openid-specs-ab-bounces@lists.openid.net</a>] On Behalf Of Nat<br>
>> Sakimura<br>
>> Sent: Thursday, March 14, 2013 11:29 AM<br>
>> To: Justin Richer<br>
>> Cc: <a href="mailto:openid-specs-ab@lists.openid.net">openid-specs-ab@lists.openid.net</a><br>
>> Subject: Re: [Openid-specs-ab] Language Script Tags<br>
>><br>
>> I have been parsing it to associative arrays in PHP.<br>
>><br>
>> Do you have alternative syntax proposal?<br>
>><br>
>> Nat<br>
>><br>
>> 2013/3/15 Justin Richer <<a href="mailto:jricher@mitre.org">jricher@mitre.org</a>>:<br>
>>><br>
>>> In implementing things, I've run into a problem when looking to<br>
>>> parse values with the language script tags and I'm wondering what<br>
>>> other developers have done.<br>
>>><br>
>>> Specifically, the hash tag (#) is not a valid member name in<br>
>>> JavaScript, Python, PHP, or Java (and likely many others), which<br>
>>> means I can't do a simple JSON-to-Object deserialization on any<br>
>>> fields that use this construct.<br>
>>> In other words, say I've got this JSON:<br>
>>><br>
>>>    { "client_name#en-us": "Test Client" }<br>
>>><br>
>>> Parsing that to JavaScript, I'd expect to be able to use the object<br>
>>> accessor, like:<br>
>>><br>
>>>    client.client_name#en-us<br>
>>><br>
>>> But that's not valid JavaScript. Yes, I can use array accessor<br>
>>> notation, but it's inconsistent with other fields. Similarly in<br>
>>> Java, I'd get something like this in a blindly-mapped object:<br>
>>><br>
>>>    client.getClient_name#en-us()<br>
>>><br>
>>> but that is also not a valid Java method name. It's the same basic<br>
>>> story on just about every language I've poked at in the last few<br>
>>> minutes here, so I can't be the first one to have run into this.<br>
>>> What has everyone else done to overcome this limitation in the<br>
>>> common parse/map operation? Do you have custom parsers that map the<br>
>>> field names? Do you just not use object-level accessors for these fields?<br>
>>><br>
>>>   -- Justin<br>
>>> _______________________________________________<br>
>>> Openid-specs-ab mailing list<br>
>>> <a href="mailto:Openid-specs-ab@lists.openid.net">Openid-specs-ab@lists.openid.net</a><br>
>>> <a href="http://lists.openid.net/mailman/listinfo/openid-specs-ab" target="_blank">http://lists.openid.net/mailman/listinfo/openid-specs-ab</a><br>
>><br>
>><br>
>><br>
>> --<br>
>> Nat Sakimura (=nat)<br>
>> Chairman, OpenID Foundation<br>
>> <a href="http://nat.sakimura.org/" target="_blank">http://nat.sakimura.org/</a><br>
>> @_nat_en<br>
>> _______________________________________________<br>
>> Openid-specs-ab mailing list<br>
>> <a href="mailto:Openid-specs-ab@lists.openid.net">Openid-specs-ab@lists.openid.net</a><br>
>> <a href="http://lists.openid.net/mailman/listinfo/openid-specs-ab" target="_blank">http://lists.openid.net/mailman/listinfo/openid-specs-ab</a><br>
><br>
><br>
<br>
<br>
<br>
--<br>
Nat Sakimura (=nat)<br>
Chairman, OpenID Foundation<br>
<a href="http://nat.sakimura.org/" target="_blank">http://nat.sakimura.org/</a><br>
@_nat_en<br>
_______________________________________________<br>
Openid-specs-ab mailing list<br>
<a href="mailto:Openid-specs-ab@lists.openid.net">Openid-specs-ab@lists.openid.net</a><br>
<a href="http://lists.openid.net/mailman/listinfo/openid-specs-ab" target="_blank">http://lists.openid.net/mailman/listinfo/openid-specs-ab</a><br>
</blockquote></div>