Scenario:
In my Parse backend, I have two classes:
A and B
There is no relation between A and B.
I have created a cloud code function called getAandB()
that returns a JSON somewhat like this:
{ "anObjectOfClassA" : {
id = 123456,
text = "Hello"
},
"anObjectOfClassB" : {
id = 987654,
value = 30.0
}
}
Question:
So on the client, I use PFCloud.callFunction("getAandB")
and when I receive this JSON response, is there a way to magically "transform" this into two PFObjects, one PFObject(className: "A")
and one PFObject(className: "B")
?
Remarks:
I know that if I only return a JSON like this:
{ "anObjectOfClassA" : {
id = 123456,
text = "Hello"
}
}
I can "deserialize" the response and return directly a PFObject(className: "A")
. But I can't do that in my example because the JSON contains two different types of objects.