function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Alvin Dutt 6Alvin Dutt 6 

Contacts REST API

I am using REST API to get data of all contacts in my salesforce. When retrieving the object, there is 2 json values for Account ID (Account Id and Account.Id) which one should be used and why is there 2?

User-added image
NikitaNikita
Hi Alvin,

The value in both the fields will be same, but the return types are diferent.For Account.Id, the return type will be an object.

Let me know if this helps.

Thanks and Regards,
Nikita
Alvin Dutt 6Alvin Dutt 6
Hello Nikita, 

Thank you for your reply. 

I am a bit confused on the return type(s) you are referring to. I am using JSON.NET to Deserialize the call, and when I examine the results after deserializiation, both values are string. 

It didn't return back and object, so my question is am I parsing the result incorrectly? Either way if you state that both of the values are the same, which one do you recommend I use? Note that I am asking this because I am unsure of whether or not the devs @ SalesForce will change the output of the interface later on and my code will break. 

Thank you.
NikitaNikita
Hi Alvin,

When you deserialise a JSON format, using [object] type is more advisable.
It should not break the code.

Thanks and Regards,
Nikita Acharya