# jsontocr

> JSON to Crystal JSON Mappings Converter

Latest version **1.0.2** (published 2019-03-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install jsontocr
pnpm add jsontocr
yarn add jsontocr
bun add jsontocr
```

Provides the command `jsontocr`.

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2019-03-12 |
| First published | 2019-03-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | Mark Molnar |
| Maintainers | molnarmark |
| Keywords | crystal, json, crystal, json, crystal, json, mappings, mappings, json, mappings |

## Links

- npm: https://www.npmjs.com/package/jsontocr
- Repository: https://github.com/molnarmark/jsontocr
- Homepage: https://github.com/molnarmark/jsontocr#readme
- Issues: https://github.com/molnarmark/jsontocr/issues
- npm.io page: https://npm.io/package/jsontocr

## Dependencies (1)

- [capitalize](https://npm.io/package/capitalize.md) ^2.0.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.2 (latest) — 2019-03-12
- 1.0.1 — 2019-03-12
- 1.0.0 — 2019-03-12

## README

# JSON To Crystal

Generate Crystal JSON mappings from JSON files. Outputs to STDOUT.

## Usage

```
npx jsontocr test.json > types.cr
```

## Examples

Take this JSON for example:

```json
{
  "userId": 1,
  "id": 1,
  "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
  "body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
}
```

Generated output will look like this:

```crystal
require "json"

class Root
  JSON.mapping(
    userId: {type: Float64, nilable: true},
    id: {type: Float64, nilable: true},
    title: {type: String, nilable: true},
    body: {type: String, nilable: true},
  )
end
```

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