Skip to content

Allow serialization of Properties with non-String values #2657

@cowtowncoder

Description

@cowtowncoder

(for background, see #2656 and #810)

Currently, code like so:

        Properties properties = new Properties();
        properties.put("key", 1);
        String json = new ObjectMapper().writeValueAsString(properties);

will fail with an exception because all values of Properties are assumed to be of type String.
This is due to typing fix made for #810 which leads to selection of StringSerializer -- reasonable for most cases but not all.

While use of Properties for non-String values seems like a wrong thing to do, maybe we could still support it similar to how coercion of non-String values from JSON content works with Properties (for scalars, at least).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions