Comment #2 on issue 23 by b.l.stein: String treated as array (JavaScript  
version)
http://code.google.com/p/json-template/issues/detail?id=23

Ah, I interpreted the reference document slightly different and assumed  
the .or
section to be also executed if the intended target (a list) was not there.  
Perhaps
that was just wishful thinking.

The use case for this is automatically generated JSON from an XML source. I  
often get
the following XML:
   <list>
     <item>one</item>
     <item>two</item>
   </list>

The generated JSON then becomes:
   {list: {item: ['one', 'two'] }}

Unfortunately, when the list has only one element, the resulting JSON is:
   {list: {item: 'one'}}

I don't have much control (or rather, I don't want to) over the way the  
JSON is
generated as it is done automatically by an XSLT stylesheet from an XML  
source. I was
hoping to catch this case in the template.

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JSON 
Template" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/json-template?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to