Possible Problem With List Single (BETA) Endpoint

A customer alerted us to the fact that the deserialization of the new (beta) List Single endpoint throws an error:

Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List`1[System.Object]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.

To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.

Path 'count', line 1, position 9.

I've confirmed the issue and think it arises from the fact that the JSON response isn't a pure collection object which cannot therefore be deserialized to a List:

{
"count": 1000,
"page": 1,
"results": {
"rows": [{
"columns": [{
"name": "Student User ID",
"value": "1574374"
}, {
"name": "Faculty User ID",
"value": "1574461"
}]
}, { ...

FYI, we are using the OpenAPI definitions to generate C#.NET code. Manually changing the return type from List<Object> to Object rectifies the error but the resultant data isn't very useful/manageable.

Could someone in the School dev team please take a look and let me know what you think?

Cheers and thanks,

Steve Cinquegrana | CEO and Principal Developer | Protégé Solutions

Comments

  • Brian Gray
    Brian Gray Community All-Star
    Eighth Anniversary Kudos 5 First Reply bbcon 2025 Attendee Badge

    I'm the SKYLib customer who reported the problem to @Steven Cinquegrana.

    When I access an Advanced List's content through the Try-It page, I get the expected results.

    This looks like an error in the meta-data for the endpoint - not with the code itself. The endpoint is useless in my environment until this gets fixed.

  • Hi Brian,

    Hopefully there'll be a response soon.

    The School Schema doesn't include an object definition for the List Single response. There's one for List Lists:

    CollectionOfListRead

    The CollectionOfListRead entity has the following properties:
    Property Type Description
    count integer The number of items in the collection
    next_link string For paginated responses, the URI for the next page of results
    value array of listread ListRead Class

    (Sorry for the formatting but it doesn't seem possible to insert code any more or even change font or enter multiple spaces.)

    The reason you don't have a problem with the Try It utility is that the response isn't deserialized, it's just presented as raw JSON. The issue is in the deserialization from JSON to an object model and the List Single “object model” is a simple array which defaults to a List(Of Object) when deserialized using JSON.NET.

    Cheers, Steve

  • Jared Harbour
    Jared Harbour Blackbaud Employee
    Eighth Anniversary Kudos 1 Name Dropper Participant

    Sorry for the late reply. I looked into this yesterday and I believe the problem is with the naming of the result object.

    We will work on a fix and get it released as soon as we can!

  • Jared Harbour
    Jared Harbour Blackbaud Employee
    Eighth Anniversary Kudos 1 Name Dropper Participant

    Good Morning!

    I wanted to let everyone here know that we released a fix this morning that appears to have solved the issues you were experiencing. If you still experience some issues please let us know.

  • Appears to have fixed the issue. Thanks @Jared Harbour.

    Brian, we'll have a SKYLib release addressing this out this afternoon.

    Cheers, Steve

Categories