X3D JSON Encoding
These are X3D Working Group notes on the creation of an X3D JSON encoding and a corresponding conversion process.
Mailing list discussions:
Primary design criterion: round-trippable lossless representation of X3D scene.
Conversion approach of greatest practical interest: XML to/from JSON. Issues:
- How to convert attribute names to distinguish them from child elements
- JSON handling of container elements to preserve parent/child relationships, distinguishing child elements from attributes
- Creation of JSON elements with datatypes appropriate to content (e.g., integer, float, strings, etc.)
- 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.
- Support for singleton (self-closing) XML tags also needs to be considered
- Inclusion and preservation of embedded XML namespace information in an XML (.x3d) document
- 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.
Probably smartest to first start out defining an X3D best practice.
This capability likely needs to be defined as one of the X3D standards.
Here are suggested discussion points for X3D teleconferences and future followups.
- Is there a good/consistent way for X3DOM to utilize such capabilities?
- Is there a single authoritative reference for JSON itself? and for JSON-XML conversions? See  for the JSON Data Interchange Format, need to confirm no others.
- 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 X3D Examples Archives
- 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?
- Probably lots more... What else?
- LD - Leonard Daly
- DPB - Don Brutzman
- XML to JSON Converter (provides option to assign a prefix to JSON attributes, default is @ character) 
- Apache Camel, XML JSON Data Format (camel-xmljson) 
- JSON Definition 
- ECMA 404: JSON Data Interchange Format (Final Draft) 
- JSON Markup Language (JsonML) 
- XSLTJSON: Transforming XML to JSON using XSLT 
- Converting Between XML and JSON 
- XML/JSON Perl Converter 
- IBM's PHP converter 
- Java Converter 
- Google Code Library