How to pass a json query variable in Apollo Kotlin

I am trying to pass a json query variable to query a json column. This set of variables works in the explorer. How do I pass that in Apollo Kotlin? I have tried as a json object, as a string and just the simpler orderId object, but get no result if passed as a string and get this error if passed as a JsonObject.

java.lang.IllegalStateException: Cannot write {"orderId":"KER9PHTSRAT8A"} to Json
  "jsonFilter": {
    "orderId": "KER9PHTSRAT8A"
    "delegate": "34a7Z6VXoLoVGpd9ES311yFJfTUuyh9JN35Czc9REz3j"

I wrote a custom adapter according to Custom scalar types in Apollo Kotlin - Apollo GraphQL Docs

but got stuck at providing the Type.

Hi! :wave:

When a custom scalar has no specific mapping, the codegen will use Any as the type, and AnyAdapter to convert from/to the scalar.

In this case Any is meant to represent any Json type, so null, boolean, number, arrays, objects, etc. In case of objects, this will be represented as Map<String, Any?> in kotlin.

So in your case, you should be able to pass a Map to your operation variable, something like:

val myQuery = MyQuery(param =
    "jsonFilter" to 
        "orderId" to "KER9PHTSRAT8A"
    "delegate" to "34a7Z6VXoLoVGpd9ES311yFJfTUuyh9JN35Czc9REz3j",

Sweet, thanks so much!