[X3D-Ecosystem] x3d.py. NavigationInfo.type and url fields.

Don Brutzman don.brutzman at gmail.com
Thu Aug 7 10:08:31 PDT 2025


John, thank you for identifying this problem when converting to JSON.  The
detailed description that you have crafted provides a good example of
"almost a repeatable issue report".

You have provided *valid input .x3d* and a reportedly* improper output in
JSON.*

Please provide what you think the *correct JSON output* needs to be.

I looked online and quickly found

   - X3D Example Archives: X3D4WA, X3D for Web Authors, Chapter 04 Viewing
   Navigation, Navigation Info Example
   -
   https://x3dgraphics.com/examples/X3dForWebAuthors/Chapter04ViewingNavigation/NavigationInfoExampleIndex.html
   -
   https://x3dgraphics.com/examples/X3dForWebAuthors/Chapter04ViewingNavigation/NavigationInfoExample.x3d
   -
   https://x3dgraphics.com/examples/X3dForWebAuthors/Chapter04ViewingNavigation/NavigationInfoExample.json

which includes the (correctly expressed, highly validated) .x3d node

<NavigationInfo DEF='FLY_FIRST
<https://x3dgraphics.com/examples/X3dForWebAuthors/Chapter04ViewingNavigation/NavigationInfoExample.html#FLY_FIRST>
' type='"FLY" "ANY"'/>


but then provides the (awkwardly expressed) .json conversion result:

          { "NavigationInfo":
            {
              "@DEF":"FLY_FIRST",
              "@type":"\"FLY\" \"ANY\""
            }
          },

Wondering, is that conversion correct?  (Am guessing no, it is not)

Based on the X3dToJson conversion page, I'd expect something different:

   - X3D to JSON Stylesheet Converter: Examples, Origami Cranes
   - https://www.web3d.org/x3d/stylesheets/X3dToJson.html#OrigamiCranes

with (direct link to fragment
<https://www.web3d.org/x3d/stylesheets/X3dToJson.html#OrigamiCranes:~:text=%7B%20%22NavigationInfo%22%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22%40type%22%3A%5B%22NONE%22%5D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%7D%2C>),
then adapted here for your example:


*          { "NavigationInfo":
            {
              "@type":["FLY" "ANY"]
            }
          },*

*Wondering, do you think this the proper way to express that X3D MFString
array in JSON?*

Based on the "railroad track" diagrams for JSON arrays and MFString,
the square brackets look good to me:


   - X3D to JSON Stylesheet Converter: JSON Arrays
   - https://www.web3d.org/x3d/stylesheets/X3dToJson.html#arrays
   -
   - [image: image.png]
   -
   MFString is array of quoted SFString (XML attribute) values JSON
array of *string* type


p.s. (One more point, please: let's proceed step by step... There is
no need to discuss Python whatsoever in this issue, that is a separate
issue we can tackle after this.  Including it as part of the mix here
only adds unnecessary complexity/confusion.)


Thanks for all efforts.

v/r Don



On Thu, Aug 7, 2025 at 12:14 AM John Carlson <yottzumm at gmail.com> wrote:

> For Aaron:  Another notice on PythonSeriializer.js and x3d.py
>
> PythonSerializer.js translates NavigationInfo.type to:
>
> NavigationInfo8 = x3d.NavigationInfo()
> NavigationInfo8.type = ["ANY","EXAMINE","WALK","FLY","LOOKAT"]
>
> Which appears OK to me.
>
> When I get X3D JSON output from x3d.py, I get:
>
>     {
>         "NavigationInfo":
>         {
>       {
>         "@type":""ANY" "EXAMINE" "WALK" "FLY" "LOOKAT""
>       }
>     },
>
>
> Which doesn't look right at all.
>
> I pretty much know that X3D JSON output from x3d.py has been iffy.  I
> wonder if Aaron has better output as X3D JSON with url fields especially.
> Can any JSON generating Python be shared yet?  Maybe after SIGGRAPH and
> Web3D Conference?
>
> Python is attached,and original .x3d.as well as JSON output
>
> Thanks for any additions to x3d.py!
>
> I am looking at the GraalPySerializer.js and realizing I left some
> semicolons in.  Retesting is going well, but apparently, I need to set up a
> function or alias in bash to do things right.
>
> John
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-ecosystem_web3d.org/attachments/20250807/7a191dea/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 6621 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-ecosystem_web3d.org/attachments/20250807/7a191dea/attachment-0001.png>


More information about the X3D-Ecosystem mailing list