FasterXML / FasterXML/jackson-dataformats-text

Infer non-string types from property values.

Open
#20 7 comments 2 reactions 0 assignees View on GitHub
Properties
Dominant language
Java
Stars
455
Forks
164
Avg merge
6d 10h
Merged PRs (30d)
2

Description

It would be great if there was a way to specify a non-string property value when mapping to the generic `ObjectNode` type. For example:

```
Properties props = new Properties();

props.setProperty("booleanExample", "true");
props.setProperty("integerExample", "4");
props.setProperty("stringExample", "some string");

ObjectNode root = new JavaPropsMapper().readValue(props, ObjectNode.class);

System.out.println(new ObjectMapper().writeValueAsString(root));
```

This code outputs

`{"integerExample":"4","booleanExample":"true","stringExample":"some string"}`

But it would be great if there was some configuration or way to escape property values such that the output inferred integer or boolean types from the values themselves:

`{"integerExample":4,"booleanExample":true,"stringExample":"some string"}`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.