jsoncodegen-generator-kotlin-jackson

1.0.2 • Public • Published

generator-kotlin-jackson

jsoncodegen JSON to Kotlin code generator for Jackson.

Generates Kotlin data classes from jsoncodegen interfaces. They can be instantiated like this:

val myObject = MyObject(
  name = "Budapest",
  flag = true,
  count = 3.0
)

Number is mapped to Double.

Enums are mapped to Kotlin enums, arrays to Lists, maps will become Maps.

Install

npm i -D jsoncodegen-generator-kotlin-jackson

Use

Remember to use com.fasterxml.jackson.module.kotlin.jacksonObjectMapper rather than the regular ObjectMapper.

Configure

Configuration can be put in jsoncodegen-generator-kotlin-jackson.config.js and passed to jsoncodegen in the config parameter:

jsoncodegen --generator java-jackson --config jsoncodegen-generator-kotlin-jackson.config.js ...

jsoncodegen-generator-kotlin-jackson.config.js

module.exports = {
  package: 'com.example'
}

package?: string

The name of the target package. All generated classes will be in this package. Example: "com.example"

License

MIT

History

1.0.0 Initial version.

/jsoncodegen-generator-kotlin-jackson/

    Package Sidebar

    Install

    npm i jsoncodegen-generator-kotlin-jackson

    Weekly Downloads

    2

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    15.2 kB

    Total Files

    19

    Last publish

    Collaborators

    • andraaspar