[X3D-Ecosystem] x3d.py. NavigationInfo.type and url fields.
John Carlson
yottzumm at gmail.com
Thu Aug 7 17:30:04 PDT 2025
I have posted followup information here:
https://yottzumm.blogspot.com/2025/08/progress-on-json-array-for-mfstring.html?m=1
On Thu, Aug 7, 2025 at 2:08 PM John Carlson <yottzumm at gmail.com> wrote:
> An alternate form that some people might be considerings an XML MFString
> as a single string in a JSON array. What we actually want is comma
> separated SFString’s in a JSON array (with surrounding [ ]).
>
> We really want any MFString encoded in JSON to be treated the same,
> regardless of where they appear. I don’t really care whether they look
> like XML or not, we just want uniformity.
>
> I have demonstrated that JSON arrays work. has anyone demonstrated that
> XML MFStrings in JSON work better?
>
> John
>
> On Thu, Aug 7, 2025 at 1:45 PM John Carlson <yottzumm at gmail.com> wrote:
>
>> Please Don’t update X3dToJson.xslt to use MFString XML syntax, it already
>> does this. We want what’s been done in the past for url fields to apply to
>> NavigationInfo.type fields.
>>
>> Sorry if this seems confusing as heck.
>>
>> We want both NavigationInfo.type and urls to be JSON arrays. With
>> commas, please!
>>
>> John
>>
>> On Thu, Aug 7, 2025 at 1:09 PM Don Brutzman <don.brutzman at gmail.com>
>> wrote:
>>
>>> So sorry John but I really have no idea what you are talking about in
>>> your response.
>>>
>>> I just looked but am not finding what you refer to in the tickets on
>>> sourceforge, there are many overlapping entries regarding converters. It
>>> is challenging but I will continue to tackle reported problems there, one
>>> by one.
>>>
>>> - https://sourceforge.net/p/x3d/tickets/
>>>
>>> Confirmation by anyone on JSON MFString syntax will help, all shared
>>> understanding is welcome. Recap, best example so far seems to be
>>>
>>> * { "NavigationInfo":
>>> {
>>> "@type":["FLY" "ANY"]
>>> }
>>> },*
>>>
>>> Given best assessments and well-formed JSON checks regarding syntax, I
>>> will work on
>>>
>>> - updating X3dToJson.xslt to match the MFString "railroad tracks"
>>> syntax,
>>> - updating autogenerated x3d.py serialization into JSON to perform
>>> MFString representations similarly,
>>> - (someday) produce an X3D JSON Schema autogenerated from X3DUOM to
>>> support type-aware X3D JSON validation.
>>>
>>> Hope this helps. Very respectfully, Don
>>>
>>> On Thu, Aug 7, 2025 at 10:41 AM John Carlson <yottzumm at gmail.com> wrote:
>>>
>>>> Don, this is a separate issue, separate from X3DJSAIL. You have been
>>>> provided the correct information many times. You have been pointed at the
>>>> spec many times you list below many times. Aaron was addressed in this
>>>> message, not you. If you want an example of correct MFStrings in JSON,
>>>> beyond what I’ve provided, look at url fields in X3D JSON.
>>>>
>>>> AFAIK, X3dToJson web pages has been correct for a long time and
>>>> X3dToJson.xslt was correct until other logic got introduced. At the time,
>>>> I complained, and I continued to complain and we kept getting stuck in the
>>>> same loop. I thought that Aaron might have a solution for RawKee and
>>>> x3d.py, so I messaged him.
>>>>
>>>> Please return to SourceForge, I have provided a one-liner as to what I
>>>> expect.
>>>>
>>>> Thanks,
>>>>
>>>> John
>>>>
>>>>
>>>> On Thu, Aug 7, 2025 at 12:08 PM Don Brutzman <don.brutzman at gmail.com>
>>>> wrote:
>>>>
>>>>> 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/9d7ace84/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/9d7ace84/attachment-0001.png>
More information about the X3D-Ecosystem
mailing list