[X3D-Ecosystem] Testing mixed type MF fields in JSON.

John Carlson yottzumm at gmail.com
Sat Aug 9 21:38:44 PDT 2025


Initial testing with npx validate showed that validation brings up Electron
now.  ????

If you download
https://github.com/coderextreme/x3dvalidate


You can use node.js in the folder created,

like:

$ git clone
https://github.com/coderextreme/x3dvalidate
$ cd x3dvalidate
$ node index.js file1.json file2.json file3.x3dj …

Results will be printed out below.

If anyone knows a way to drag a JSON file to a desktop icon and have a
JavaScript program validate a the JSON file, I’m all ears.  Adding a app
association might work.

John
On Sat, Aug 9, 2025 at 4:36 AM John Carlson <yottzumm at gmail.com> wrote:

> Another heads up, now that we have (all detected) MFStrings as JSON
> arrays, it’s critical that we have type-safe JSON arrays.  I’m going to do
> some effort at testing “bad” MF* JSON arrays, ones that a mixture of
> strings integers, floats, etc. against JSON schema and XML schema.  Let’s
> hope for excellent results!
>
> I will also test for strings in numerical arrays!
>
> Most likely, I’ll be using these 2 repos:
>
> For Java and XML schema:
>
> https://github.com/coderextreme/x3dschema
>
> For JavaScript and JSON schema:
>
> https://github.com/coderextreme/x3dvalidate
>
> I don’t have a timetable yet.
>
> I’m also open to developing Kotlin, JRuby, Clojure, GraalPy, and GraalJS
> validators, if people are interested.  This applies to Schematron as well,
> all using X3DJSAIL.  Scala is a possible option as well!   If you use Arch
> BTW (or any Linux), I will try for a TruffleRuby port!   I haven’t heard of
> people using Groovy except in Gradle recently, but sure!  I also have a
> couple of Intel Macs!
>
> If people want to contribute their X3D JSON examples, welcome!  Even links
> to huge zips are welcome!
>
> I will also consider making a CheerpJ Java-based JavaScript web app, if
> enough people show interest.
>
> This will be purely for testing JSON, other encodings do not apply.
>
> If someone had a python JSON validator that they like to use,  let me know!
>
> John
>
> On Fri, Aug 8, 2025 at 12:25 PM John Carlson <yottzumm at gmail.com> wrote:
>
>> Agreed, great work everyone!
>>
>> On Fri, Aug 8, 2025 at 12:21 PM Don Brutzman via X3D-Ecosystem <o
>> x3d-ecosystem at web3d.org> wrote:
>>
>>> Am happy to serve, we have such a great team working together. I hope
>>> that everyone has a great weekend!
>>>
>>> all the best, Don
>>>
>>> --
>>> Don Brutzman
>>> X3D graphics, virtual worlds, Navy robotics
>>> https://faculty.nps.edu/brutzman
>>>
>>>
>>> On Fri, Aug 8, 2025 at 08:34 Holger Seelig via X3D-Ecosystem <
>>> x3d-ecosystem at web3d.org> wrote:
>>>
>>>> Thank you Don, for this fix. It clarifies everything and simplifies
>>>> things.
>>>>
>>>> Best regards,
>>>> Holger
>>>>
>>>>>>>> Holger Seelig
>>>> Leipzig, Germany
>>>>
>>>> holger.seelig at yahoo.de
>>>> https://create3000.github.io/x_ite/
>>>> https://patreon.com/X_ITE
>>>>
>>>>
>>>>
>>>> Am 08.08.2025 um 17:20 schrieb Don Brutzman via X3D-Ecosystem <
>>>> x3d-ecosystem at web3d.org>:
>>>>
>>>> BLUF: NavigationInfo.type problem fixed in JSON conversion.
>>>> Troubleshooting summary follows.
>>>>
>>>> After some deep-dive debugging, I figured out the root cause of
>>>> conversion problems.  NavigationInfo.type was inadvertantly being
>>>> misclassified as SFString vice MFString in the X3dToJson.xslt stylesheet.
>>>>
>>>> Issue summary:
>>>>
>>>>    - valid 1-line .x3d:    <NavigationInfo type=' "EXAMINE" "FLY" "ANY"
>>>>    '/>
>>>>    - failing 1-line .json: { "NavigationInfo": {"@type":"\"EXAMINE\"
>>>>    \"FLY\" \"ANY\""}},
>>>>    - goal 1-line .json:   { "NavigationInfo": {"@type":
>>>>    ["EXAMINE","FLY","ANY"]}},
>>>>
>>>> Stylesheet flaw now fixed, NavigationInfo.type outputs are much more
>>>> readable and understandable.  Updated example url addresses follow,
>>>> corrected from before.  (Please be advised that x3dgraphics.com site
>>>> is no longer latest version, the primary build is migrated to web3d.org
>>>> ).
>>>>
>>>>    - X3D Example Archives: X3D4WA, X3D for Web Authors, Chapter 04
>>>>    Viewing Navigation, Navigation Info Example
>>>>    -
>>>>    https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter04ViewingNavigation/NavigationInfoExampleIndex.html
>>>>    -
>>>>    https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter04ViewingNavigation/NavigationInfoExample.html#25
>>>>    -
>>>>    https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter04ViewingNavigation/NavigationInfoExample.json
>>>>
>>>> Corrected JSON excerpt:
>>>>           { "NavigationInfo":
>>>>
>>>>             {
>>>>               "@DEF":"FLY_FIRST",
>>>>               "@type":["FLY","ANY"]
>>>>             }
>>>>           },
>>>>
>>>> Am now running regression builds on all .json conversions in X3D
>>>> Examples Archives.  Results from last night have gotten through about half
>>>> of the archives.  Have posted interim results at the regular location for
>>>> preliminary inspection today, if desired.
>>>>
>>>>    - https://www.web3d.org/x3d/content/examples/build.json.all.log.txt
>>>>
>>>> C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors/Chapter04ViewingNavigation//NavigationInfoExample.json
>>>>> validation checking with jslint
>>>>> C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors/Chapter04ViewingNavigation//NavigationInfoExample.json
>>>>> validation checking with json-schema-validator
>>>>> ... does not support latest JSON Schema, this test is not yet usable
>>>>
>>>>
>>>> Continuing, I checked the other stylesheet converters for this
>>>> necessary evaluation of Navigation.type as MFString vice SFString.  The
>>>> same bug found was elsewhere and fixed.
>>>>
>>>> Checking the revised Java converter, looks like actual results were
>>>> nevertheless handled OK:
>>>>
>>>>    -
>>>>    https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter04ViewingNavigation/NavigationInfoExample.java
>>>>    -
>>>>
>>>>    .addChild(new NavigationInfo("FLY_FIRST").setType(new String[] {"FLY","ANY"}))
>>>>
>>>>
>>>> Checking the revised Python converter, again looks like actual results
>>>> were handled OK:
>>>>
>>>>    -
>>>>    https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter04ViewingNavigation/NavigationInfoExample.py
>>>>    -
>>>>
>>>>    NavigationInfo(DEF='FLY_FIRST',type=["FLY","ANY"]),
>>>>
>>>>
>>>> And so, the example .x3d model and the various stylesheet corrections
>>>> have been committed to version control.   Stylesheets are online at
>>>>
>>>>
>>>>    -
>>>>    https://sourceforge.net/p/x3d/code/HEAD/tree/www.web3d.org/x3d/stylesheets/
>>>>    - https://sourceforge.net/p/x3d/code/37350/ shows revision
>>>>
>>>> Hopefully this is all sorted out now.  Future work will look at
>>>> X3DJSAIL Java and X3DPSAIL x3d.py Python export to ensure consistent
>>>> results.
>>>>
>>>> Thanks for all support in identifying this issue and determining the
>>>> proper correction needed.
>>>>
>>>> All the best, Don
>>>>
>>>>
>>>>
>>>>
>>>> On Thu, Aug 7, 2025 at 11:08 AM 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.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
>>>>>>>>
>>>>>>> --
>>>>
>>>> X3D-Ecosystem mailing list
>>>> X3D-Ecosystem at web3d.org
>>>> http://web3d.org/mailman/listinfo/x3d-ecosystem_web3d.org
>>>>
>>>>
>>>> --
>>>> X3D-Ecosystem mailing list
>>>> X3D-Ecosystem at web3d.org
>>>> http://web3d.org/mailman/listinfo/x3d-ecosystem_web3d.org
>>>>
>>> --
>>> X3D-Ecosystem mailing list
>>> X3D-Ecosystem at web3d.org
>>> http://web3d.org/mailman/listinfo/x3d-ecosystem_web3d.org
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-ecosystem_web3d.org/attachments/20250809/202173f3/attachment-0001.html>


More information about the X3D-Ecosystem mailing list