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

John Carlson yottzumm at gmail.com
Fri Mar 27 10:30:07 PDT 2026


How did I discover this issue? I noticed a large number of differences in
roundtripping of Coordinate.point in many facial animation examples I
created.  I was a like OMG, parts of the scenegraph are disappearing.  But
what was happening was the HAnimSegment field nodes were being reordered by
x3d-tidy!  So roundtripping doesn’t work unless you canonicalize and fix
DEF/USE and canonicalize your originals and output from all your tools.

Note, JinBlink.x3d should be validated by someone, and I’m expecting a
report from Don.

John
On Fri, Mar 27, 2026 at 10:19 AM John Carlson <yottzumm at gmail.com> 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
>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20260327/41b53ee3/attachment.html>


More information about the x3d-public mailing list