#1 2021-01-14 15:16:27

fabiovip2019
Member
Registered: 2019-03-14
Posts: 76

Output variables

Hello everyone, after I updated the mormot I noticed a difference in interface-based services. In my applications I always used a procedure with two output variables. A Result call of the variant type, which I used to pass status (errors, success and messages) and another call Data, which I used to pass data to the user interface, which always results in a json like this:

 {
    "Result": {
        "Code": 0
    },
    "Data": {
        some dto object
    }
}

After the update it seems to me that the mormot no longer considers the second output variable and writes the json like this:

 {
    "result": [
        {
            "Code": 0
        },
        {
          some dto object
        }
    ]
}

Has anything been changed in this regard?

Last edited by fabiovip2019 (2021-01-14 15:32:54)

Offline

#2 2021-01-14 16:22:03

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Output variables

mORMot returns either a JSON object or a JSON array.
By default it is a JSON array, but it may be a JSON object if you specify it.

Check https://synopse.info/files/html/Synopse … #TITLE_466
and https://synopse.info/files/html/Synopse … #TITLE_470

We didn't change anything about this, as far I can tell.

Offline

#3 2021-01-14 16:25:45

macfly
Member
From: Brasil
Registered: 2016-08-20
Posts: 374

Re: Output variables

This is controlled by ResultAsJSONObject and ResultAsJSONObjectWithoutResult options.

In Doc:
https://synopse.info/files/html/Synopse … #TITLE_470

Offline

#4 2021-01-14 18:19:58

fabiovip2019
Member
Registered: 2019-03-14
Posts: 76

Re: Output variables

Thanks macfly,

Thanks, ResultAsJSONObjectWithoutResult was really missing.

Offline

Board footer

Powered by FluxBB