[x3d-public] Remove property prefixes: @, - and # in X3D JSON?

John Carlson yottzumm at gmail.com
Mon Feb 16 19:13:15 PST 2026


Here’s the background material in “A JSON encoding for X3D”:

==========

During development it became clear that it was necessary to make it easy to
distinguish the names of fields from the names of nodes, since both appear
as JSON strings. It was decided to prepend a non-alphabetic character to
field names, using different characters for the two field categories. This
makes it easy for parsers, loaders and validators to recognize the string
as a field name, and identify any errors in usage.
============

I’m guessing this is development of Coin3D?   With my serializers, it was
easy enough to use fieldTypes.js, after the prefixes were removed by
X3DJSONLD and converted to DOM.  A more direct conversion to DOM would be
appreciated!

https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/fieldTypes.js


It might be helpful to distinguish nodes from statements as well?

Of course, if one is reading directly into scenegraph, without my handy
type lookup table, I can understand why one might want a field
discriminator.

So now I ask, do we really need something to distinguish types of
properties in JavaScript?  Are there workarounds for other languages like
fieldTypes.js that can help?   Surely, we can use X3DUOM to generate such
artifacts?

John

On Mon, Feb 16, 2026 at 8:21 PM John Carlson <yottzumm at gmail.com> wrote:

> For those who aren’t familiar, I will try to outline the requirement for
> @, - and # property prefixes in X3D JSON.
>
> @ is for non-MFNode, non-SFNode fields.
> - is for MFNode and SFNode fields.
> # is for comments and source code—shaders and scripts.
>
> The problem is that when you want to access, say geometry or appearance,
> you have to do:
>
> shape[‘-appearance’] instead of shape.appearance.
>
> AFAIK, shape.-appearance just doesn’t work.
>
> Similarly,
>
> transform[‘@translation’]
>
> vs
>
> transform.translation
>
> And again, transform. at translation doesn’t work.
>
> I understand there might be problems with this “new” approach.  Let’s try
> to lay out pros vs cons.
>
> I think my current goal is to make parsing and generation of JSON easy.
> My thought is to take out the @ and leave - and #.   We already have
> examples of that in the X3D node.
>
> What do you think?
>
> John
>
> On Mon, Feb 16, 2026 at 7:55 PM John Carlson <yottzumm at gmail.com> wrote:
>
>> As one can see from this example code, the property prefixes @, # and -
>> aren’t necessary in X3D JSON:
>>
>> https://github.com/coderextreme/my-second-react-three-app/blob/main/src/App.jsx
>>
>> Let’s think about removing these from X3D JSON.  We need to consider
>> performance and ease of use and development.   If there’s no need, why did
>> we invent the prefixes, to make JavaScript and TypeScript developers tear
>> their hair out?
>>
>> Thanks!
>>
>> John
>>
>> On Mon, Feb 16, 2026 at 6:47 PM John Carlson <yottzumm at gmail.com> wrote:
>>
>>> If there’s time on the agenda, I’d like to present a beginnings of an
>>> “X3D JSON” viewer/editor developed with AI using React and THREE.js with
>>> WebGPU renderer.  This is quite different than the three-x3d-loader
>>> previously presented, and is along the lines of AFrame but  not even
>>> Interchange profile.
>>>
>>> There’s obviously a lot more work to do.
>>>
>>> Thanks!
>>>
>>> John
>>>
>>> On Mon, Feb 16, 2026 at 4:47 PM Anita Havele via AI <ai at web3d.org>
>>> wrote:
>>>
>>>> Anita Havele <anita.havele at web3d.org> has invited you to Agenda —
>>>> AI-X3D SIG Meeting on Feb 17, 2026 AT 8:00 AM PST (GMT-8)
>>>>
>>>> --
>>>> AI mailing list
>>>> AI at web3d.org
>>>> http://web3d.org/mailman/listinfo/ai_web3d.org
>>>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20260216/c82811d1/attachment.html>


More information about the x3d-public mailing list