fun registerWith(registrar: Registrar) { val channel = MethodChannel(registrar.messenger(), "jsonmethodcodec_test_plugin", JSONMethodCodec.INSTANCE) channel.setMethodCallHandler(JsonmethodcodecTestPlugin()) } } override fun onMethodCall(call: MethodCall, result: Result) { if (call.method == "setUser") { val json = call.arguments as JSONObject val user = json.getJSONObject("user") val id = user.getInt("id") val name = user.getString("name") val age = user.getInt("age") result.success(null) } JSONObjectから Jsonの要素を取得 する