[X3D-Public] x3d to json experiments & links of interest
kristian.sons at dfki.de
Tue Jul 8 00:37:44 PDT 2014
just a few comments from my side (and my experience having written some
X3D parsers / toolkits):
JSON is actually kind of similar to the VRML syntax, with some
advantages (it needs less context to parse). The common feature of JSON
and VRML -- despite the optical similarities -- is to define multiple
named array entries that can in turn contain structured content (often
called "containers"). XML encoding has only _one_ container for child
elements (called "children" in the API). That is what X3D in XML always
suffered from: X3D requires an additional attribute to specify the
container. This concept is well hidden using default values, but
requires the XSD (i.e. context). And it suddenly pops up, once a user is
dealing with the most underestimated concept of X3D: Prototypes.
So I wonder why to (re-)import this flaw to JSON? Why not something like:
This style would clearly expose the container names and thus also help
users who want to use the API.
Apart from the encoding, I wonder how useful a JSON representation is.
From our experience, the advantages in terms of size is negligible
compared to XML because the numbers make the main workload. To transfer
heavy geometry and texture data, there are many other, more compelling
alternatives (see papers from last and next Web3D :).
Just my two cents :)
> Still hoping to hear from x3dom developers on their use of JSON and
> relevant use cases of X3D in JSON form.
>> 6. Suggested discussion points for the X3D teleconference and future
>> a. What are the use cases for having X3D JSON available in
>> b. Is there a good/consistent way for X3DOM to utilize such
>> utilize such capabilities?
>> d. Is there a single authoritative reference for JSON itself? and
>> for JSON-XML conversions?
>> e. Compare compression of a TestMesh.x3d.json.gz to TestMesh.x3db
>> and TestMesh.x3d.exi
>> (EXI will likely win because it includes data typing)
>> f. 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 the3800+ X3D Examples Archive scenes
>> g. Decide if this capability needs to be defined in one of the X3D
>> standards, or perhaps as an X3D best practice.
>> h. Probably lots more... What else?
> More information on JSON <==> XML follows.
> Don McGregor (who has translated the DIS protocol to JSON) reports the
> following ECMA standard for JSON.
> (14 pages)
> It does not mention XML, and therefore does not address the potential
> use of - or @ (or whatever) characters to distinguish child JSON
> fields as elements or attributes. Absent any other specifications,
> this would seem to provide rationale for our defining an official JSON
> encoding for X3D.
> The following commercial posting discusses this issue a little:
> XSLT and XPath for JSON
> By Mark Joseph - May 6, 2008
> The following reference from json.org is also interesting:
> JSON Markup Language (JsonML)
>> JsonML (JSON Markup Language) is an application of the JSON
>> provide a compact format for transporting XML-based markup as JSON
>> which allows it to be losslessly converted back to its original form.
>> is stored in script it must be properly encoded as an opaque string.
>> JsonML allows easy manipulation of the markup in script before
>> completely rehydrating back to the original form.
> This site also includes the following syntax definition for lossless
> round-trip conversion:
>> Syntax Reasoning
>> JsonML was designed for lossless roundtrip conversion between XML and
>> JSON and to handle "mixed-mode content" (i.e., textual data outside
>> of or next to elements). Key considerations were lossless two-way
>> conversion and compactness of form. JsonML handles namespaces in the
>> same way that XML 1.0 does: attributes for xmlns and tag names with
>> JsonML was never intended to be the way that everything that could be
>> expressed in XML should be expressed in JSON. JsonML is the only
>> transformation which can safely encode "mixed-mode" content in XML,
>> which is a key characteristic in a markup language such as XHTML.
>> Many other transformations exist for representing XML in a JSON format.
>> Grammar (BNF)
>> The following grammar represents how XML-based markup (e.g. XHTML) is
>> encoded into JsonML. As per JSON, whitespace is permitted between
> all the best, Don
Deutsches Forschungszentrum für Künstliche Intelligenz GmbH, DFKI
Agenten und Simulierte Realität
Campus, Geb. D 3 2, Raum 0.77
66123 Saarbrücken, Germany
Phone: +49 681 85775-3833
Phone: +49 681 302-3833
Fax: +49 681 85775--2235
kristian.sons at dfki.de
Geschäftsführung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster (Vorsitzender)
Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the X3D-Public