[x3d-public] JSON Encoding

Don Brutzman brutzman at nps.edu
Mon Dec 21 16:27:17 PST 2015


Very helpful, merci beacoup.

Excerpt from json5.org:
=========================
"JSON is an excellent data format, but we think it can be better.

JSON5 is a proposed extension to JSON that aims to make it easier for humans to write and maintain by hand. It does this by adding some minimal syntax features directly from ECMAScript 5.

JSON5 remains a strict subset of JavaScript, adds no new data types, and works with all existing JSON content.

JSON5 is not an official successor to JSON, and JSON5 content may not work with existing JSON parsers. For this reason, JSON5 files use a new .json5 extension."
=========================

Interesting how they simply fixed some issues we had, such as comments and multiline strings.

On 12/21/2015 4:11 PM, Cecile Muller wrote:
> Good evening Don,
>
>
>> 1. In the proposed alternative example (again attached), what would the full object reference from the top of the scene graph be?
>
> The path in HelloWorldCommentedAlternativeEncoding.json is:
> * data.X3D.Scene['-children'][4].Group['-children'][3].Transform['-children'][1].Shape['-appearance'][0].Appearance['-material'][0].Material['@diffuseColor']*

Wondering, does JSON5 provide an alternative syntax for referencing the same JSON structure?  or is rewriting the scene in the fashion you describe necessary first?

> You can run this in Node to test:
> https://gist.github.com/cecilemuller/efa310a5f2923ce360ba

very helpful, thanks

>> 2.  A code snippet that showed how to test such a reference in node.js console would be helpful...
>
> Sure, already posted one (this one however additionally needs the json5 module):
> https://gist.github.com/cecilemuller/14e168f7864ac66c61d3
>
>
>> 3. Wondering what is the formal status of JSON5?  Am not finding that it is specified anywhere.
>
> Its reference is at http://json5.org and its js module has 1.7 million downloads a month.
>
> See you,
> Cecile

hmmm.  if JSON5 is not authoritative, it might be difficult for us to utilize it since Web3D Consortium plans to produce an official X3D JSON Encoding (ISO 19776-5) specification document once the syntax is stabilized.

http://www.web3d.org/specifications/X3dSpecificationRelationships.png
http://www.web3d.org/specifications/X3dSpecificationRelationships.pdf

all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman



More information about the x3d-public mailing list