I am using Java 1.8 and Jackson v2.11.4 library to serialize a class which has String properties that represent Linux paths. The problem manifests itself when I am using a Windows 10 machine but not when using a Linux one.
e.g. the property to be serialized has the value “/Results_Store/VM_Results” and what actually gets stored in the JSON file is the value “\Results_Store\VM_Results”
I imagine that Jackson performs some platform sensitive interpretation of the string value correlating it with a File or Path object and performs an automatic conversion using the java.io.File.separator.
I tried using the @JsonSerialize(using = ToStringSerializer.class)
annotation before the property but does not work.