Get a list of data from a JSON array

Hello, guys...

I need your help... I am trying to get, through an REST api, an array of JSON object, such as:


    "date": "2020-07-24 16:00:00",

    "open": 3215.200000000000,

    "low": 3214.890000000000,

    "high": 3216.130000000000,

    "close": 3216.130000000000,

    "volume": 2250933565



    "date": "2020-07-24 15:59:00",

    "open": 3213.950000000000,

    "low": 3213.950000000000,

    "high": 3215.200000000000,

    "close": 3215.200000000000,

    "volume": 2222597737



    "date": "2020-07-24 15:58:00",

    "open": 3212.050000000000,

    "low": 3212.050000000000,

    "high": 3214.560000000000,

    "close": 3213.950000000000,

    "volume": 2201634597



    "date": "2020-07-23 15:52:00",

    "open": 3228.550000000000,

    "low": 3225.520000000000,

    "high": 3228.550000000000,

    "close": 3225.890000000000,

    "volume": 2291842251



    "date": "2020-07-23 15:51:00",

    "open": 3233.620000000000,

    "low": 3227.590000000000,

    "high": 3233.620000000000,     "close": 3228.550000000000,     "volume": 2280398243   }


In such a way I stored a structure as follows: 

In preparation, as I wanted to store only the dates, I just get the method to get the data from the api and I have gone for each loop, in order to append each of  those dates records into a list... 

It just doesn`t work and I keep getting the same error: Failed to parse response of the method 'Get_GSPC' of the 'Financialmodelingprep2' REST API:
Parsing '': Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'sseWallet.CcFinancialmodelingprep2+RESTGet_GSPCResponseList' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
Path '', line 1, position 1.

Hi Lucas,

You created a record that received a list, but no json that you sent a list is being returned directly, so then change the structure to Get_GSPCResponse with the attributes inside, without having the list object inside.

1- Delete the Get_GSPCResponseList structure.

2- When calling the service, use the variable Get_GSPCResponse and place it with a list type;

Eduardo Benites


Hi Lucas,

First, there's no need to assign the dates in a loop and ListAppend. You can do a ListAppendAll and just map the date.

Secondly, like Eduardo said, that Structure is wrong, which causes the error. I don't know what is the exact output of the REST method, so it's difficult to advise what to do exactly. In general, when you consume the REST method, you copy/paste the JSON from an example as output, and Service Studio creates the Structures for you.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.