I tried to to use json4s native library. Here is how I use it:
Builder b = new JsonMessageBuilder();
Map<String, List<Object>> m2 = new HashMap<>();
m2.put("e", Arrays.asList(new StringBuilder(123)));
b.message(JavaConverters.mapAsScalaMapConverter(m2).asScala());
public static class Test{
@Override
public String toString(){
return "test";
}
}
Where
class JsonMessageBuilder{
def message[A <: AnyRef](a: A) = println(Serialization.write(a))
}
But the code prints this:
{"e":[{}]}
How to force serialization of toString
result in a map? I want to have
{"e":["test"]}