Skip to content

🔮 JSON to Crystal JSON Mappings Converter

Notifications You must be signed in to change notification settings

molnarmark/jsontocr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

{
  "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:

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

About

🔮 JSON to Crystal JSON Mappings Converter

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published