1

I am receiving following json from server with pointer data type

[
{
"abc":{"__type":"Pointer","className":"ABC","objectId":"iHHyf1Rerw"}
}
]

now how i can fetch other fields from ABC class name. I have tried to fetch with following way:

ParseObject obj = parseObject.get(position).getParseObject("abc");

now i am trying to fetch

obj .getString("colname")

but i am getting colname not exists

2 Answers 2

1

When you query parse objects with pointer you need to use include in order to fetch also the pointer along with the query data.

After you specify the include parse-server will fetch also the pointer data (and not only the reference) so in order to do it you need to write you query in the following way (from parse docs):

enter image description here

Please notice that there they use include in order to also populate the post parse object which exist under the comment so in your case you need to use query.include("abc")

Sign up to request clarification or add additional context in comments.

2 Comments

HI Hassid, you answer really helped me alot. Thanks
I am very happy :)
0

Try this :

ParseObject obj = parseObject.get(position).getParseObject("abc");
if(obj.has("__type"){
    String type = obj.getString("__type");
}if(obj.has("className"){
    String className = obj.getString("className");
}if(obj.has("objectId"){
    String objectId = obj.getString("objectId");
}

1 Comment

but i know some keys exists in pointed class still i am getting keys not exists so i cannot say this is correct answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.