scala 踩坑记

1、scala 中使用 fastjson 时,会报错:

Error:(34, 18) ambiguous reference to overloaded definition,
both method toJSONString in object JSON of type (x$1: Any, x$2: com.alibaba.fastjson.serializer.SerializerFeature*)String
and  method toJSONString in object JSON of type (x$1: Any)String
match argument types (Object) and expected result type Any
    println(JSON.toJSONString(value))

解决办法:

println(JSON.toJSONString(value))

改为

println(JSON.toJSONString(info, SerializerFeature.EMPTY: _*))
发布了82 篇原创文章 · 获赞 13 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/magic_kid_2010/article/details/103816312