[X3D-Ecosystem] X3DUOM to Zod (StandardSchema.dev) to JSON schema

John Carlson yottzumm at gmail.com
Wed Feb 18 07:03:55 PST 2026


Here’s an apparent example of creating a JSON schema from a zod schema in
TypeScript from google search:

import { z } from "zod";

const PersonSchema = z.object({
name: z.string().describe('The name of the person'),
age: z.number().meta({ examples: [30, 45] }), // Use .meta() for complex
metadata
});

const jsonSchema = z.toJSONSchema(PersonSchema);

console.log(jsonSchema);





On Wed, Feb 18, 2026 at 7:48 AM John Carlson <yottzumm at gmail.com> wrote:

> If you want to approach JSON schema slightly differently, consider
> generating a StandardSchema.dev schema (based on Zod in this case).  I
> believe one can generate any number of JSON schema draft schemas from this.
>
> None of this has been checked, and may be incomplete.  It's merely
> provided as an example for generating a TypeScript StandardSchema.
>
> I don't own the copyright to this code, it's merely an example of how one
> might create a TypeScript schema from (and ultimately a JSON schema), but
> not according to the design of X3D JSON schema.  I'm not sure that's
> possible.  Whether this can create the X3D JSON design with this, with the
> field prefixes, is questionable.  So perhaps a useless endeavor.  But using
> strings for properties might be possible if you're going to generate this
> code for the real thing.
>
>  uomzod.txt
> <https://drive.google.com/open?id=1qiC--RmWoXNfna4hwzEiOSNQW2nAGFU8>
>
> John
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-ecosystem_web3d.org/attachments/20260218/4cb8cb7f/attachment.html>


More information about the X3D-Ecosystem mailing list