Difference between revisions of "X3D JSON Encoding"

From Web3D.org
Jump to: navigation, search
(References)
(Discussion points)
Line 23: Line 23:
 
* If so, it would be good to spell them out and understand them well.
 
* If so, it would be good to spell them out and understand them well.
 
* We want conversion rules to permit implementations that can achieve user goals.
 
* We want conversion rules to permit implementations that can achieve user goals.
 +
 +
== Standardization ==
 +
 +
Probably smartest to first start out defining an X3D best practice.
 +
 +
This capability likely needs to be defined as one of the [http://www.web3d.org/specifications/X3dSpecificationRelationships.png X3D standards].
  
 
== Discussion points ==
 
== Discussion points ==
Line 33: Line 39:
 
# Compare compression size and decompression speed of a TestMesh.x3d.json.gz to TestMesh.x3db and TestMesh.x3d.exi (EXI will likely win because it includes data typing)
 
# Compare compression size and decompression speed of a TestMesh.x3d.json.gz to TestMesh.x3db and TestMesh.x3d.exi (EXI will likely win because it includes data typing)
 
# Once a canonical form for X3D as JSON is established, add conversion capabilities to X3D-Edit and also autoconvert, test and publish JSON for all of the 3800+ scenes in the [http://www.web3d.org/x3d-resources/content/examples/X3dResources.html#Examples X3D Examples Archives]
 
# Once a canonical form for X3D as JSON is established, add conversion capabilities to X3D-Edit and also autoconvert, test and publish JSON for all of the 3800+ scenes in the [http://www.web3d.org/x3d-resources/content/examples/X3dResources.html#Examples X3D Examples Archives]
# Decide if this capability needs to be defined in one of the [http://www.web3d.org/specifications/X3dSpecificationRelationships.png X3D standards], or perhaps as an X3D best practice.
+
#  
 
# What is the right file extension?  .json, .x3dj or others
 
# What is the right file extension?  .json, .x3dj or others
 
# Can a file reader distinguish the incoming encodings (.x3d .x3dv .x3db .x3de .json) independent of file extension or MIME media type?
 
# Can a file reader distinguish the incoming encodings (.x3d .x3dv .x3db .x3de .json) independent of file extension or MIME media type?

Revision as of 15:59, 10 September 2014

Preliminary notes on the creation of an X3D JSON encoding.

  • This page is to understand the conversion process so that a high-quality encoding definition can be created
  • Don Brutzman started a thread on the X3D-Public list.
    • Initial message [1]
    • July's thread listing [2]

Conversion Considerations

Primary design criterion: round-trippable lossless representation of X3D scene.

Conversion approach of greatest practical interest: XML to/from JSON. Issues:

  1. How to convert attribute names to distinguish them from child elements
  2. JSON handling of container elements to preserve parent/child relationships, distinguishing child elements from attributes
  3. Creation of JSON elements with datatypes appropriate to content (e.g., integer, float, strings, etc.)
  4. Both X3D and JSON can include comments, and so need an option for inclusion (by default) or removal (optional) of comments in order to ensure 100% round-trip conversion capabilities.
  5. Support for singleton (self-closing) XML tags also needs to be considered
  6. Inclusion and preservation of embedded XML namespace information in an XML (.x3d) document

Use cases

Are there any special use cases for having X3D JSON available in JavaScript?

  • Are there any use cases that might modify how X3D is represented in JSON?
  • If so, it would be good to spell them out and understand them well.
  • We want conversion rules to permit implementations that can achieve user goals.

Standardization

Probably smartest to first start out defining an X3D best practice.

This capability likely needs to be defined as one of the X3D standards.

Discussion points

Here are suggested discussion points for X3D teleconferences and future followups.

  1. Is there a good/consistent way for X3DOM to utilize such capabilities?
  2. Is there a way for Three.js X3D loader, or other javascript libraries, to utilize such capabilities?
  3. Is there a single authoritative reference for JSON itself? and for JSON-XML conversions? See [6] for the JSON Data Interchange Format, need to confirm no others.
  4. Compare compression size and decompression speed of a TestMesh.x3d.json.gz to TestMesh.x3db and TestMesh.x3d.exi (EXI will likely win because it includes data typing)
  5. Once a canonical form for X3D as JSON is established, add conversion capabilities to X3D-Edit and also autoconvert, test and publish JSON for all of the 3800+ scenes in the X3D Examples Archives
  6. What is the right file extension? .json, .x3dj or others
  7. Can a file reader distinguish the incoming encodings (.x3d .x3dv .x3db .x3de .json) independent of file extension or MIME media type?
  8. Probably lots more... What else?

Contributors

  • LD - Leonard Daly
  • DPB - Don Brutzman

References

  • XML to JSON Converter (provides option to assign a prefix to JSON attributes, default is @ character) [3]
  • Apache Camel, XML JSON Data Format (camel-xmljson) [4]
  • JSON Definition [5]
  • ECMA 404: JSON Data Interchange Format (Final Draft) [6]
  • JSON Markup Language (JsonML) [7]
  • XSLTJSON: Transforming XML to JSON using XSLT [8]
  • Converting Between XML and JSON [9]
  • XML/JSON Perl Converter [10]
  • IBM's PHP converter [11]
  • Java Converter [12]
  • Google Code Library [13]