bildwelt
E2E FORUM
E2E Bridge E2E Commerce

JSON null valued fields

E2E Forum Modeling & Development JSON null valued fields

This topic contains 6 replies, has 2 voices, and was last updated by  Jakub 2 years, 9 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1770

    Cliff Faurer
    Participant

    Hello,

    I’m working with the classToJSON() operation and it’s producing null valued fields in the JSON. Notice in the attached screenshot that only the leading null valued attributes in front of a valued attribute are rendered in the JSON. The training null valued attributes are not rendered in the JSON.

    Is there a configuration parameter to request that null valued attributes are not rendered in the JSON?

    Thanks,
    Cliff

    Attachments:
    You must be logged in to view attached files.
    #1777

    Jakub
    Moderator

    Hi,

    currently there is no way to configure this behaviour. The current implementation indeed preserves leading null fields and skips trailing ones.


    Grüsse,
    Jakub

    #1780

    Cliff Faurer
    Participant

    Hello Jakub,

    Sounds like a bug. Can the behavior be changed to not preserve the leading null fields? And maybe also add an configuration parameter to preserve all null fields if desired.

    Thanks,
    Cliff

    #1781

    Jakub
    Moderator

    Hello Cliff,

    I wouldn’t call it a bug, but it is quite a big inconsistency. And one *almost* never care if the field is null or undefined.
    Nevertheless, I’m opening tasks regarding this.


    Grüsse,
    Jakub

    #1782

    Cliff Faurer
    Participant

    Hello Jakub,

    Thanks for opening a task for this inconsistency.

    Regards,
    Cliff

    #1820

    Cliff Faurer
    Participant

    Hello Jakub,

    What’s the status on this issue? It’s causing a problem in retrieving content from a DB as only some fields are returned and the classToJSON() is preserving the null fields, which were not requested on the REST query.

    Example GET with fields=href,nameType,status :

    [
    {
    "id": "000000049995f58400003da40000058cf1c70ece",
    "href": "http://localhost:10002/partyManagement/organization/000000049995f58400003da40000058cf1c70ece",
    "isLegalEntity": null,
    "type": null,
    "tradingName": null,
    "nameType": "string",
    "status": "initialized"
    },
    {
    "id": "0000000b99961a6100003da40000058cf2570c4a",
    "href": "http://localhost:10002/partyManagement/organization/0000000b99961a6100003da40000058cf2570c4a",
    "isLegalEntity": null,
    "type": null,
    "tradingName": null,
    "nameType": "string",
    "status": "initialized"
    }
    ]

    Example GET:

    [
    {
    "id": "000000049995f58400003da40000058cf1c70ece",
    "href": "http://localhost:10002/partyManagement/organization/000000049995f58400003da40000058cf1c70ece",
    "isLegalEntity": true,
    "type": "string",
    "tradingName": "diglet",
    "nameType": "string",
    "status": "initialized",
    "existsDuring": {
    "startDate": "2015-02-17T21:51:41.538Z",
    "endDate": "2015-02-17T21:51:41.538Z"
    },
    "otherName": [
    {
    "tradingName": "string",
    "nameType": "string",
    "validFor": {
    "startDateTime": "2015-02-17T21:51:41.538Z",
    "endDateTime": "2015-02-17T21:51:41.538Z"
    }
    }
    ],
    "characteristic": [
    {
    "name": "string",
    "value": "string"
    }
    ],
    "organizationIdentification": [
    {
    "identificationId": "string",
    "type": "string",
    "issuingAuthority": "string",
    "issuingDate": "2015-02-17T21:51:41.538Z"
    }
    ],
    "externalReference": [
    {
    "href": "string",
    "type": "string"
    }
    ],
    "relatedParty": [
    {
    "href": "string",
    "role": "string",
    "name": "string",
    "validFor": null,
    "alias": [
    {
    "type": "string",
    "value": "string"
    }
    ],
    "status": "string"
    }
    ],
    "organizationParentRelationship": {
    "href": "string",
    "relationshipType": "string"
    },
    "organizationChildRelationship": [
    {
    "href": "string",
    "relationshipType": "string"
    }
    ],
    "contactMedium": [
    {
    "type": "string",
    "isPreferred": true,
    "validFor": null,
    "medium": {
    "city": "string",
    "country": "string",
    "emailAddress": "string",
    "type": "string",
    "number": "string",
    "postcode": "string",
    "stateOrProvince": "string",
    "street1": "string",
    "street2": "string"
    }
    }
    ]
    },
    {
    "id": "0000000b99961a6100003da40000058cf2570c4a",
    "href": "http://localhost:10002/partyManagement/organization/0000000b99961a6100003da40000058cf2570c4a",
    "isLegalEntity": true,
    "type": "string",
    "tradingName": "penny",
    "nameType": "string",
    "status": "initialized",
    "existsDuring": {
    "startDate": "2015-02-17T21:51:41.538Z",
    "endDate": "2015-02-17T21:51:41.538Z"
    },
    "otherName": [
    {
    "tradingName": "string",
    "nameType": "string",
    "validFor": {
    "startDateTime": "2015-02-17T21:51:41.538Z",
    "endDateTime": "2015-02-17T21:51:41.538Z"
    }
    }
    ],
    "characteristic": [
    {
    "name": "string",
    "value": "string"
    }
    ],
    "organizationIdentification": [
    {
    "identificationId": "string",
    "type": "string",
    "issuingAuthority": "string",
    "issuingDate": "2015-02-17T21:51:41.538Z"
    }
    ],
    "externalReference": [
    {
    "href": "string",
    "type": "string"
    }
    ],
    "relatedParty": [
    {
    "href": "string",
    "role": "string",
    "name": "string",
    "validFor": null,
    "alias": [
    {
    "type": "string",
    "value": "string"
    }
    ],
    "status": "string"
    }
    ],
    "organizationParentRelationship": {
    "href": "string",
    "relationshipType": "string"
    },
    "organizationChildRelationship": [
    {
    "href": "string",
    "relationshipType": "string"
    }
    ],
    "contactMedium": [
    {
    "type": "string",
    "isPreferred": true,
    "validFor": null,
    "medium": {
    "city": "string",
    "country": "string",
    "emailAddress": "string",
    "type": "string",
    "number": "string",
    "postcode": "string",
    "stateOrProvince": "string",
    "street1": "string",
    "street2": "string"
    }
    }
    ]
    }
    ]

    Thanks,
    Cliff

    #1823

    Jakub
    Moderator

    Since it’s causing troubles, I’ll increase the priority. Hopefully it’ll make its way to the next release.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.