Update your schema as per below:
const jsonSchema = z.lazy(() => z.union([z.object({ title: z.string() }), z.record(jsonSchema)]) );
For more information, you can check the docs