Skip to content

Simple converters for serialize and deserialize #22

@jgornick

Description

@jgornick

For simple converters, creating an IPropertyConverter seems a bit overkill. It would be nice to specify a function as part of a decorator for serialization or deserialization.

For example:

@JsonProperty('wifi_signal')
@JsonDeserailizer((value) => !value ? 0 : value * 20)
public wifiSignalStrength: number
@JsonProperty('wifi_signal')
@JsonSerializer((value) => !value ? 0 : value / 20)
public wifiSignalStrength: number

Thoughts?

Cheers,

  • Joe

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions