UNPKG

json-to-schema-generator

Version:

json-to-schema is a lightweight and powerful utility that generates JSON Schema from a given JSON object. It automatically detects the structure of the JSON, including nested objects and arrays, and generates a corresponding schema that can be used for va

20 lines (19 loc) 550 B
interface JsonSchema { type: string; properties?: { [key: string]: any; }; items?: { type: string; properties?: { [key: string]: any; }; }; required?: string[]; } declare const generateJsonSchema: (jsonObject: any) => JsonSchema; declare const validateJsonWithSchema: (jsonObject: any, schema: any) => { isValid: boolean; errors: import("ajv").ErrorObject<string, Record<string, any>, unknown>[] | null | undefined; }; export { generateJsonSchema, validateJsonWithSchema };