Describe the bug
Cells which have been converted to non-string types of "number" or "boolean" are being set back to "string" on restarting OpenRefine (or possible on project save?)
To Reproduce
Steps to reproduce the behavior:
Current Results
Before restarting the values show as the expected types
After restarting the values show as Strings
Expected behavior
Values should retain type as set
Screenshots
Before restart:

After restart:

Desktop (please complete the following information):
OpenRefine (please complete the following information):
Additional context
Dates do not seem affected by this issue
Possible this is related to #1996?
I agree this is important, it's probably linked to the Jackson migration.
@wetneb I've done some further investigation into this and #1996. It looks to me like the problem is with com.google.refine.modelCell.getValueasString https://github.com/OpenRefine/OpenRefine/blob/ebaad96dfc33f44b1a0904800cd8bdac7c655220/main/src/com/google/refine/model/Cell.java#L105 which leads "v" to always serialise to a string
In the case of booleans or numbers (of any type that can be represented as a number in JSON) then these should be serialized to their native types in JSON rather than as a string. I could probably fix this, but I'm not very confident.
I also feel that possibly this whole aspect of Cell.java might benefit from re-factoring using Jackson annotations (e.g. could the date processing done here be equally well handled by a @JsonFormat annotation? ) - but I don't have the knowledge to be sure about the best way to approach this.
Any views? I'm happy to try a PR which you can comment on if you want? Or do you already have this in hand?
@ostephens Thanks a lot for the investigation. Yes it looks like I have overlooked the type issue when rewriting this.
I am not working on this at the moment but solving this is clearly required before 3.2. A PR for this would be fantastic!
@wetneb is there any good intro to using Jackson annotations you'd recommend?
I found these ones helpful:
For this particular problem, I would say you could try by changing getValueAsString to return Object instead (and probably change the method name), returning the right object type for JSON聽serialization. Jackson will serialize Java's booleans as JSON booleans, and so on. If I remember correctly the ObjectMapper is already configured for date serialization. So I probably just made this method a lot more complicated (and a lot less correct) than it should be!
Closed by #2008