# @redocly/json-to-json-schema

> Convert JSON example into JSON schema

Latest version **0.0.1** (published 2022-03-16) · SEE LICENSE IN LICENSE license · 0 weekly downloads

## Install

```sh
npm install @redocly/json-to-json-schema
pnpm add @redocly/json-to-json-schema
yarn add @redocly/json-to-json-schema
bun add @redocly/json-to-json-schema
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2022-03-16 |
| First published | 2022-03-16 |
| Weekly downloads | 0 |
| License | SEE LICENSE IN LICENSE |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 12.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Roman Hotsiy |
| Maintainers | romanhotsiy, alawar, adamaltman, marshevskyy, andriyleliv |

## Links

- npm: https://www.npmjs.com/package/@redocly/json-to-json-schema
- npm.io page: https://npm.io/package/@redocly/json-to-json-schema

## Recent versions

- 0.0.1 (latest) — 2022-03-16

## README

# json-to-json-schema

Convert JSON examples into JSON schema.

Supports JSON Schema Draft 5 used in Swagger 2.0 and OpenAPI 3.0 and new draft `draft-2020-12` used in OpenAPI 3.1.

## Usage

```js
import { convert, format } from '@redocly/json-to-json-schema';

const example = { "firstname": "John", "surname": "Doe", "birthday": "1990-02-23" };

const schema = convert(example, {
  target: 'draft-05-oas', // or draft-2020-12
  includeExamples: false,
});
```

## Similar tools

https://github.com/mohsen1/json-to-json-schema

---
_Source: https://npm.io/package/@redocly/json-to-json-schema · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
