When importing JSON do not create default objects for null - Mendix Forum

When importing JSON do not create default objects for null

2

Assume that the JSON looks like:

{
    "id": "some-id",
    "subobject": {
        "this": "value",
        "that": false
    }
}


When importing it then subobject is created and its attributes are set. However when subobject is null, like in the JSON example below, then the object is still created by the importer but with default values as specified by the entity in the domain model.
 

{
    "id": "some-id",
    "subobject": null
}

 

When the subobject is null then do not create the object. This saves making assumptions by checking attributes in that object if the object is actually not supposed to be there, or if it contains real data.

 

asked
0 answers