[x3d-public] Getting JSON that works, Canonical JSON

John Carlson yottzumm at gmail.com
Fri Mar 27 10:12:01 PDT 2026


One thing that Holger did to fix x3d-tidy was to reorder components, units
and metas in the head statement.  This shows that reordering is possible,
it may just be very difficult and problematic in a stylesheet if we don’t
have canonicalization, to agree between tools.

So we have the DEF/USE (DAG) alternative.  We’ve been here before.  Can we
create a stylesheet that orders DEF/USE properly from disordered DEF/USE?
This will require quite a bit of my rework away from using stylesheets to
X3DJSAIL, but I’ve already prepared batch validation and schematron with
X3DJSAIL.  Typically I batch stylesheets jobs.

I think that adding DEF/USE reordering would be a valuable thing to add to
X3DJSAIL.  I’m guessing it’s being considered.

John

On Fri,  Mar 27, 2026 at 11:54 AM John Carlson <yottzumm at gmail.com> wrote:

> The whole point is for our tools to agree on field order output, or handle
> DEF/USE (DAG) according to the standard.  Apparently FreeWRL can’t handle
> reordering of DEF/USE.  Can we agree on field ordering/canonicalization?
> For at least HAnimSegment and HAnimHumanoid?
>
> This applies to RawKee, Castle, X_ITE, Blender, stylesheets and X3DJSAIL.
>
> Do we need to standardize field ordering, or always apply canonicalization
> on output?  Can X3DUOM help here?
>
> I realize I’m skirting the issue.
>
> John
> On Fri, Mar 27, 2026 at 10:47 AM Don Brutzman <don.brutzman at gmail.com>
> wrote:
>
>> Please keep things simple.  An X3D model is either valid or not.
>>
>> An X3D JSON model has limited validation capabilities on its own, namely
>> jsonlint to confirm that it is well formed.
>>
>> An excellent test of any converters is whether round-trip conversion is
>> possible.  If information is lost or incorrectly structured, then that
>> round-trip test reveals that something somewhere didn't work.  Further
>> sleuthing and corrections are then appropriate for further work.
>>
>> When XML encoding is part of round-trip testing, then immense set of
>> quality assurance diagnostics are available.
>>
>> Exceedingly long conversion chains might reveal a difficulty, but they
>> are often confusing and unhelpful for precise debugging and correction.
>>
>> Recommend working on small examples, one at a time.  That way any
>> conversion flaws can be fixed, one at a time.  Step by step.
>>
>> all the best, Don
>> --
>> X3D Graphics, Maritime Robotics, Distributed Simulation
>> Relative Motion Consulting  https://RelativeMotion.info
>>
>>
>> On Fri, Mar 27, 2026 at 8:20 AM John Carlson via x3d-public <
>> x3d-public at web3d.org> wrote:
>>
>>> To be clear:
>>>
>>> .x3d->x3d-tidy->.x3dj->X3DJSONLD->DOM->Serializer->Java,
>>> etc.->X3DJSAIL/stylesheets->XML, JSON, (more?) probably won’t work in many
>>> cases, due to DEF/USE reordering within SFNode field reordering.  I am not
>>> saying the .x3dj files are bad files.
>>>
>>> x3d->X3dToJson.xslt->.json->X3DJSONLD->DOM->Serializer->Java, etc.->X3DJSAIL/stylesheets->XML,
>>> JSON, (more?) probably will work.
>>>
>>> Using Canonical form might solve this issue.  But what is canonical JSON?
>>>
>>> Specific ordering issues that that have come up include head statements,
>>> HAnimHumanoid and HAnimSegment nodes.
>>>
>>> Please try to ensure that the authors ordering is preserved, or use
>>> canonical form.
>>>
>>> Note that X3DJSONLD *should* act like a pass through.  But further work
>>> to achieve canonical form may be desired.
>>>
>>> X3DJSAIL/stylesheets should stick with canonical form, if it uses it,
>>> but warn of potential DEF/USE reordering, if it can’t handle DEF/USE
>>> reordering under canonicalization.
>>>
>>> x3d-tidy should also stick with canonical form, or not modify canonical
>>> form or alternatively, author’s intent.
>>>
>>> Does this seem reasonable?
>>>
>>> John
>>>
>>>> _______________________________________________
>>> x3d-public mailing list
>>> x3d-public at web3d.org
>>> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20260327/21cd2915/attachment-0001.html>


More information about the x3d-public mailing list