<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-GB link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Cecile,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thanks. An interesting comparison, which I hadn’t considered.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>But then, I wonder, where would you be calling up such a path? Surely, this would be in some form of programmatic access, such as with the SAI or DOM, for example. This is just an encoding, for storage in an external file. Whichever form happened to be used the content when loaded into an application/web browser would be identical. So the form of the encoding would be irrelevant …<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>The point of my effort was to find a way to keep the comments and ROUTEs within a scene maintained identically, so that lossless round tripping can occur from one encoding to another, e.g. XML to JSON to XML. Your listing removes the comments from the scene and incorporates them externally to the structured JSON. While that may be possible with comments it is surely not possible with ROUTEs.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Regards,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Roy<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> x3d-public [mailto:x3d-public-bounces@web3d.org] <b>On Behalf Of </b>Cecile Muller<br><b>Sent:</b> 21 December 2015 22:30<br><b>To:</b> X3D Graphics public mailing list<br><b>Subject:</b> Re: [x3d-public] JSON Encoding<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><div><div><p class=MsoNormal>Good evening,<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Let's take this example from the mailing-list:<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal> <span style='font-size:7.5pt'>{ "Shape":</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> {</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> "-content": [</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> { "#comment":"Sphere begin"},</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> { "Sphere":</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> {</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> }</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> },</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> { "#comment":"Sphere complete, Appearance begin"},</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> { "Appearance":</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> {</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> "-content": [</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> { "#comment":"Material begin"},</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> { "Material":</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> {</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> "@DEF":"MaterialLightBlue",</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> "@diffuseColor":[0.1,0.5,1]</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> }</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> },</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> { "#comment":"Material complete, ImageTexture begin"},</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> { "ImageTexture":</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> {</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> "@DEF":"ImageCloudlessEarth",</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> "@url":["earth-topo.png”]</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> }</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> },</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> { "#comment":"ImageTexture complete"}</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> ]</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> }</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> },</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> { "#comment":"Appearance complete"}</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> ]</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> }</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> }</span><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Given a reference "data" to the root of the structure, you would have to use this to access the color:<o:p></o:p></p></div><div><p class=MsoNormal> "<b>data.Shape['-content'][3].Appearance['-content'][1].Material['@diffuseColor']</b>"<o:p></o:p></p></div><div><p class=MsoNormal>which is quite a mouthful.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Compare to this JSON5 structure instead:<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal> <span style='font-size:7.5pt'>{</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> "$": "Shape",</span><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> // Sphere begins</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> "geometry": {</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> "$": "Sphere"</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> },</span><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><span style='font-size:10.0pt'> // Sphere complete, Appearance begin</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> "appearance": {</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> "$": "Appearance",</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> "material": {</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> "$": "Material",</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> "$DEF": "MaterialLightBlue",</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> "diffuseColor": [0.1, 0.5, 1]</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> },</span><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> // Material complete, ImageTexture begin</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> "texture": {</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> "$": "ImageTexture",</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> "$DEF": "ImageCloudlessEarth",</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> "url": ["earth-topo.png"]</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> }</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> // ImageTexture complete</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> }</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> // Appearance complete</span><o:p></o:p></p></div><div><p class=MsoNormal><span style='font-size:7.5pt'> }</span><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>This time, you can access the color simply using: "<b>data.appearance.material.diffuseColor</b>".<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>See you,<o:p></o:p></p></div><div><p class=MsoNormal>Cecile<o:p></o:p></p></div></div></div></div></body></html>