#1 2015-10-16 15:02:45

cypriotcalm
Member
Registered: 2015-02-18
Posts: 122

Bug in TServiceMethodExecute.ExecuteJson by validatin input parameters

Hi Ab,

if I POST the following JSON

[
      {
        "iD": 1,
        "name": "a"
      },
      {
        "iD": 2,
        "name": "b"
      }
]

the first square bracket is removed by invalidating input parameters.

...
                              if Par^ in [#1..' '] then repeat inc(Par) until not(Par^ in [#1..' ']);
                              case Par^ of
                              '[': // input arguments as a JSON array , e.g. '[1,2,"three"]' (default)
 THIS REMOVES THE BRACKET-->       inc(Par);
                              '{': begin // retrieve parameters values from JSON object
...

Offline

#2 2015-10-16 15:24:34

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

Re: Bug in TServiceMethodExecute.ExecuteJson by validatin input parameters

Parameters are transmitted as a json array.

So you have to put your array parameter within another json array.

Offline

#3 2015-10-16 15:36:59

cypriotcalm
Member
Registered: 2015-02-18
Posts: 122

Re: Bug in TServiceMethodExecute.ExecuteJson by validatin input parameters

ab wrote:

Parameters are transmitted as a json array.

So you have to put your array parameter within another json array.


Okay, I have just tried this option

[[
      {
        "iD": 1,
        "name": "a"
      },
      {
        "iD": 2,
        "name": "b"
      }
]]

still missing the first bracket...

Could you please provide a right example of this array? Thank you!

Offline

Board footer

Powered by FluxBB