编译器如何找到 Json.obj() 的隐式方法?

How does the compiler find the implicit method for Json.obj()?

我们可以像这样构建一个 json 对象:

import java.time.Instant
import play.api.libs.json.Json

object Test extends App {
  println(Json.obj("time" -> Instant.now()))
  //Output: {"time":"2018-05-25T18:13:23.409Z"}
}

Json.obj()方法的签名是:

def obj(fields: (String, JsValueWrapper)*): JsObject

虽然隐式方法Json.toJsFieldJsValueWrapper不在范围内,但Instant.now()如何成功转换为JsValueWrapper?预先感谢您的回复!

我从这里得到答案Outer Objects for Nested Types。原因是嵌套类型的外部对象也贡献隐式。