I've been trying to write some json modules that I can bring in to openscad using alt-insert and I keep getting errors, mostly because I don't really know what I am doing with json.
So I tried to find an editor where I can type in openscad code formatted exactly as I want it to appear in openscad and have the editor format it correctly in json for me. But I cannot find one. All the ones I have found so far- and there are a lot of them- seem to rely on you knowing exactly how to format json- which of course, I don't. And at my age, json syntax is rather confusing.
So does anyone know of an editor that will take openscad code and format it as json thatwill retain correct openscad format when importing it using alt-insert?
Or am I asking too much?
A baby can be defined as an ego with a noise at one end and a smell at the other.
Your job as parents is to teach them to control all three.
My job as a grandad is to tell you how you are doing it all wrong!
On Sunday, February 15, 2026 at 03:32:38 AM EST, Ken via Discuss discuss@lists.openscad.org wrote:
I've been trying to write some json modules that I can bring in to openscad using alt-insert
and I keep getting errors, mostly because I don't really know what I am doing with json.
So I tried to find an editor where I can type in openscad code formatted exactly as I want it to appear
in openscad and have the editor format it correctly in json for me. But I cannot find one. All the ones
I have found so far- and there are a lot of them- seem to rely on you knowing exactly how to format json-
which of course, I don't. And at my age, json syntax is rather confusing.
Apparently this is a new feature?
https://stackoverflow.com/questions/72309949/how-to-enable-json-import-in-openscad
with the specific example being:
https://github.com/mmalecki/catchnhole
I believe that what you want is a structured editor which enforces/implements JSON syntax.
Top hit searching for that is:
Have you tried that yet?
William
Thanks William, but no, this is not a new feature- see here-
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_User_Interface/Advanced
about half-way down the page, "Editor templates"
And the editor you pointed to won't do what I need, like all I have found so far, it expects you to type in the json code.
On 2026-02-16 00:48, William F. Adams wrote:
On Sunday, February 15, 2026 at 03:32:38 AM EST, Ken via Discussdiscuss@lists.openscad.org wrote:
I've been trying to write some json modules that I can bring in to openscad using alt-insert
and I keep getting errors, mostly because I don't really know what I am doing with json.
So I tried to find an editor where I can type in openscad code formatted exactly as I want it to appear
in openscad and have the editor format it correctly in json for me. But I cannot find one. All the ones
I have found so far- and there are a lot of them- seem to rely on you knowing exactly how to format json-
which of course, I don't. And at my age, json syntax is rather confusing.
Apparently this is a new feature?
https://stackoverflow.com/questions/72309949/how-to-enable-json-import-in-openscad
with the specific example being:
https://github.com/mmalecki/catchnhole
I believe that what you want is a structured editor which enforces/implements JSON syntax.
Top hit searching for that is:
Have you tried that yet?
William
A baby can be defined as an ego with a noise at one end and a smell at the other.
Your job as parents is to teach them to control all three.
My job as a grandad is to tell you how you are doing it all wrong!
Copy the json from the example and just change the OpenSCAD code between
the quotes and the key value between quotes.
On Sun, 15 Feb 2026 at 20:14, Ken via Discuss discuss@lists.openscad.org
wrote:
Thanks William, but no, this is not a new feature- see here-
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_User_Interface/Advanced
about half-way down the page, "Editor templates"
And the editor you pointed to won't do what I need, like all I have found
so far, it expects you to type in the json code.
On 2026-02-16 00:48, William F. Adams wrote:
On Sunday, February 15, 2026 at 03:32:38 AM EST, Ken via Discuss discuss@lists.openscad.org discuss@lists.openscad.org wrote:
I've been trying to write some json modules that I can bring in to openscad using alt-insert
and I keep getting errors, mostly because I don't really know what I am doing with json.
So I tried to find an editor where I can type in openscad code formatted exactly as I want it to appear
in openscad and have the editor format it correctly in json for me. But I cannot find one. All the ones
I have found so far- and there are a lot of them- seem to rely on you knowing exactly how to format json-
which of course, I don't. And at my age, json syntax is rather confusing.
Apparently this is a new feature?
https://stackoverflow.com/questions/72309949/how-to-enable-json-import-in-openscad
with the specific example being:
https://github.com/mmalecki/catchnhole
I believe that what you want is a structured editor which enforces/implements JSON syntax.
Top hit searching for that is:
https://jsoneditoronline.org/
Have you tried that yet?
William
A baby can be defined as an ego with a noise at one end and a smell at the other.
Your job as parents is to teach them to control all three.
My job as a grandad is to tell you how you are doing it all wrong!
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
On 2/15/2026 12:32 AM, Ken via Discuss wrote:
I've been trying to write some json modules that I can bring in to
openscad using alt-insert and I keep getting errors, mostly because I
don't really know what I am doing with json.
I suggest that you start with a working example, copy it changing only
the "key" entry, confirm that the new copy works, then edit it until you
like the result. The only thing that might be tough is that none of the
stock templates include a string, and so you need to know to type "
when you want a double quote.
So I tried to find an editor where I can type in openscad code
formatted exactly as I want it to appear in openscad and have the
editor format it correctly in json for me. But I cannot find one. All
the ones I have found so far- and there are a lot of them- seem to
rely on you knowing exactly how to format json- which of course, I
don't. And at my age, json syntax is rather confusing.
So does anyone know of an editor that will take openscad code and
format it as json thatwill retain correct openscad format when
importing it using alt-insert?
Or am I asking too much?
So you want something that, given a block of text, will give you a JSON
string that represents that text?
Or, perhaps more generally, that you give a block of text and a few
additional pieces of metadata to, and it produces an OpenSCAD template
file ready-to-go?
I wouldn't try to do it as an editor. I'd do it as something that would
consume a block of text that you prepared in a different editor, and
spit out JSON.
Sure. The hard part is figuring out what language I could write it in,
that you could then run. Are you on Windows? MacOS? Linux? Do you
have Python available?
But the rules really aren't that complex, for the kind of text that
you're likely to want.
Put this stuff before the line:
{
"key": "name-that-you-want-in-menu",
"content":
and this after:
}
On Mon, 2026-02-16 at 07:13 +1100, Ken via Discuss wrote:
Thanks William, but no, this is not a new feature- see here-
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/The_OpenSCAD_User_Interface/Advanced
about half-way down the page, "Editor templates"
And the editor you pointed to won't do what I need, like all I have
found so far, it expects you to type in the json code.
I'm curious. What does a json file do for you that a straight OpenSCAD
file doesn't do?
Just use visual code studio or anti-gravity
On February 15, 2026 9:10:48 PM Jordan Brown via Discuss
discuss@lists.openscad.org wrote:
On 2/15/2026 12:32 AM, Ken via Discuss wrote:
I've been trying to write some json modules that I can bring in to openscad
using alt-insert and I keep getting errors, mostly because I don't really
know what I am doing with json.
I suggest that you start with a working example, copy it changing only the
"key" entry, confirm that the new copy works, then edit it until you like
the result. The only thing that might be tough is that none of the stock
templates include a string, and so you need to know to type " when you
want a double quote.
So I tried to find an editor where I can type in openscad code formatted
exactly as I want it to appear in openscad and have the editor format it
correctly in json for me. But I cannot find one. All the ones I have found
so far- and there are a lot of them- seem to rely on you knowing exactly
how to format json- which of course, I don't. And at my age, json syntax is
rather confusing.
So does anyone know of an editor that will take openscad code and format it
as json thatwill retain correct openscad format when importing it using
alt-insert?
Or am I asking too much?
So you want something that, given a block of text, will give you a JSON
string that represents that text?
Or, perhaps more generally, that you give a block of text and a few
additional pieces of metadata to, and it produces an OpenSCAD template file
ready-to-go?
I wouldn't try to do it as an editor. I'd do it as something that would
consume a block of text that you prepared in a different editor, and spit
out JSON.
Sure. The hard part is figuring out what language I could write it in,
that you could then run. Are you on Windows? MacOS? Linux? Do you have
Python available?
But the rules really aren't that complex, for the kind of text that you're
likely to want.
Put a backslash in front of every backslash or double quote.
Put a backslash and "n" at the end of every line.
Join all of the lines together into a single line.
Put a double quite at the left end of the line, and another at the right end.
Put this stuff before the line:
{ "key": "name-that-you-want-in-menu", "content":
and this after:
}
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
On 2/15/2026 9:20 PM, larry via Discuss wrote:
I'm curious. What does a json file do for you that a straight OpenSCAD
file doesn't do?
Lets you insert canned snippets with a few keystrokes. Try Alt+Ins or
right-click, Insert Template, then double-click an entry in the list.
(Why double click? Don't know.)
You could do the same by having a collection of snippets sitting in an
editor waiting to be copy-pasted, but you'd have to keep that editor open.