Maybe Bug: JSON account structure incoerent

Hi all.
I found something strange when using REST API to get account information (i.e.: /Api/V8/module/Accounts?filter[id][eq]=<my_id_account>).
When I get information about a simple account without parent assigned, the response JSON have structure like this:

{
 "data": [
  {
   "type": "Account",
   "id": "my_account_id",
   "attributes": {
    "name": "ACCOUNT NAME",
    "date_entered": "",
    "date_modified": "2020-07-27T13:58:00+03:00",
    "modified_user_id": "1",
    [... omitted ...]
    "parent_id": "",
    "sic_code": "",
    "parent_name": "",
    "members": "",
    "member_of": {},
    [... omitted ... ]
   }
  }
 ]
}

Take a look at the field “member_of”. It is a JSON Object.

When the account, otherwise, have a parent, the structure changes (apparently a bit, but not so for a high level JSON library):

{
 "data": [
  {
   "type": "Account",
   "id": "other_account_id",
   "attributes": {
    "name": "OTHER ACCOUNT NAME",
    "date_entered": "",
    "date_modified": "2020-07-27T13:58:00+03:00",
    "modified_user_id": "1",
    [... omitted ...]
    "parent_id": "parent_account_id",
    "sic_code": "",
    "parent_name": "PARENT ACCOUNT NAME",
    "members": "",
    "member_of": "",
    [... omitted ... ]
   }
  }
 ]
}

Now, field “member_of” becomes a plain (empty) string… It is unparseable by high level JSON parsing library if it expects to receive an Object.

There seems to be an incoerent structure for the same entity type (an Account).

Any idea about it?

My guess here is that the ‘member of’ field is inherited from the parent, and hence the difference. This could plausibly be a bug, but would need to be tested with the most recent version of suiteCRM.

My thoughts from a developer perspective:

  1. What version of suiteCRM are you using?
  2. Has your version been updated from a previous version. If so, then the inconsistent field format could potentially have been inherited from the previous version from before it was updated.

If you are on the latest version, and you haven’t upgraded from a previous version, then I’d consider that to be a bug as I can’t see any reason for 2 different schema for what is essentially a empty field. Bugs can be reported here (as I can’t find any reference to it by searching for JSON in the bug search).

Otherwise, see if the problem can be reproduced on a clean install of the latest version of 7.10.x or 7.11.x, and report if you still see the error.

Thank you for reply.
I missed some information about SuiteCRM version. I’m using SuiteCRM Version 7.11.15. It is a fresh installation (not updated from previous version).

Considering your guess (field inherited from parent, that sounds interesting from a developer perspective), I tried to execute same request for parent account… and the resulting structure is the same as the first one (member_of field is a JSON Object and not a plain string).

Thank you.