Closed clwater closed 4 months ago
I'm not sure if I understand the question. So you essentially want to put another class (serialized as a json object) in under the key keys
but the result is not a JsonObject and rather a String?
I assume Gson().toJson()
returns a string, so the value will obviously also be a string. You could try this:
put("keys", Json.decodeFromString<JsonObject>(Gson().toJson("your content")))
This will put in an actual Json Object as the value.
As you understand, My question is I want put a class rather a String.
I try you suggest, It is useful.
Thanks
@clwater I suppose then this issue has been resolved?
Yes, It is resloved
General info
What is your question?
In edge functions I accept params as {"keyA": "v1", "keys":{"keyB1", "vb1", "keyB2": "vb2"}} when I check this as CLI I used
curl xxx --data '{"keyA": "v1", "keys":{"keyB1", "vb1", "keyB2": "vb2"}}'
And I can accept this and check as
console.log("keyA: " + keyA) console.log("keys['keyB1']: " + keys['keyB1'])
This is no problem. But when I used in Android I try used asval result = mFunctions.invoke( function = edge_path, body = buildJsonObject { put("keyA", "v1") put("keys", Gson().toJson("Class base as keys")) }, )
But this edge function can't run right.
As blow log file. When I request as CLI, the functions log is
keys: [object Object]
but when I rqeuest in Android this log is
keys: {"keyB1":"v1"}
I know I am used different edge request params method.But I can't find different explain in https://supabase.com/docs/guides/functions or https://supabase.com/docs/reference/kotlin/functions-invoke
What differnet between this , Or How can I make this as same format In Android ?
Thanks
Relevant log output (optional)