You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am writing a YAML file with mapper.writeValue() but the keys that start with a number are being double quoted even if the original key doesn't have the quotes.
I understand that the double quotes are being added because mapper want to avoid YAML to consider a String as a number, but it would be better for me to avoid the quotes.
I've tried with enable(YAMLGenerator.Feature.MINIMIZE_QUOTES)) but not helping with this issue.
Example:
//original key -> after writeValue()
6712dd2a-2695-49cb-89a8-9b5592951522: -> "6712dd2a-2695-49cb-89a8-9b5592951522":
The text was updated successfully, but these errors were encountered:
I think this is due to JsonGenerator.writeFieldName() taking String and Jackson's default key deserializers thereby having to write things as Strings. One exception there is is that JsonGenerator.writeFieldId(long) exists so actual integer number keys can be written as such, as long as backend allows that.
But same does not exist for other key types unfortunately.
So I am not sure this is something that can be changed the way things are; would require some new support by JsonGenerator (which despite name is just generator API for all formats, base type for YAMLGenerator).
But I will leave this open just in case someone has good ideas of how to possibly allow option to keep out the quotes :)
I am writing a YAML file with mapper.writeValue() but the keys that start with a number are being double quoted even if the original key doesn't have the quotes.
I understand that the double quotes are being added because mapper want to avoid YAML to consider a String as a number, but it would be better for me to avoid the quotes.
I've tried with enable(YAMLGenerator.Feature.MINIMIZE_QUOTES)) but not helping with this issue.
Example:
//original key -> after writeValue()
6712dd2a-2695-49cb-89a8-9b5592951522: -> "6712dd2a-2695-49cb-89a8-9b5592951522":
The text was updated successfully, but these errors were encountered: