Response data structure difference in JSON API call
I am noticing the data structure differences in the response when the response contains one record or multiple record. I have noticed this in getRecords and getRelatedRecords. It is very easy to reproduce. Construct a Url similar to one given below and make sure to use lastModifiedTime so that more than one leads are returned
https://crm.zoho.com/crm/private/json/Leads/getRecords?authtoken=<AuthToken>&scope=crmapi&fromIndex=1&toIndex=20&lastModifiedTime=2014-08-25 18:39:18
Then change the Url to force fetch just one record
https://crm.zoho.com/crm/private/json/Leads/getRecords?authtoken=<AuthToken>&scope=crmapi&fromIndex=1&toIndex=1&lastModifiedTime=2014-08-25 18:39:18
The schema difference is at "row" node which is either is an array in case of multiple results and object in case of single result. This difference isn't there if the API call is changed to XML. The JSON.Net deserializer fails as it is the same call expecting a result of a type while the return type varies depending upon if the API returned one or multiple results.
Single Result Response:
{
"response": {
"result": {
"Leads": {
"row": {
"no": "1",
...
...
...
Multiple Result Response:
{
"response": {
"result": {
"Leads": {
"row": [
{
"no": "1",
...
...
...
Has anyone else noticed this? This is clearly a bug but the Zoho support seems to be treating as feature request that would be taken care of based on
"priority and demand".