0.5.8 • Published 6 years ago

json-to-crystal v0.5.8

Weekly downloads
20
License
MIT
Repository
github
Last release
6 years ago

JSON to Crystal

Convert JSON structures to Crystal classes. A hosted version is available at https://watzon.me/projects/json-to-crystal.

Usage

const JsonToCrystal = require('json-to-crystal')

const json2crystal = new JsonToCrystal()
console.log(json2crystal.parse(`
{
    "string": "Hello world",
    "boolean": true,
    "integer": 12302932,
    "float: 232.23,
    "another_class": {
        "arr": [1, 2, 3],
        "hello": "World!"
    }
}`))
class AutoGenerated

  JSON.mapping({
    string: { type: String },
    boolean: { type: Bool },
    integer: { type: Int32 },
    float: { type: Float64 },
    another_class: { type: AnotherClass }
  })

  class AnotherClass

    JSON.mapping({
      arr: { type: Array(Int32) },
      hello: { type: String }
    })

  end
end
0.5.8

6 years ago

0.5.7

6 years ago

0.5.6

6 years ago

0.5.5

6 years ago

0.5.4

6 years ago

0.5.3

6 years ago

0.5.2

6 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.4

6 years ago

0.4.2

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago