Skip to content

Deserialization when the response is an array, but the expected model is a single object #102

@adrianiftode

Description

@adrianiftode

The expected model was a single object, and the response an array.

Expected response to have a content equivalent to a model of type "<>f__AnonymousType0`7[System.Int32,System.String,System.String,System.Int32,System.DateTime,System.Int32,System.Int32]", but the JSON representation could not be parsed, as the operation failed with the following message: "Exception while deserializing the model with SystemTextJsonSerializer: The JSON value could not be converted to <>f__AnonymousType0`7[System.Int32,System.String,System.String,System.Int32,System.DateTime,System.Int32,System.Int32]. Path: $ | LineNumber: 0 | BytePositionInLine: 1.". 

The HTTP response was:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 2025


***** Content is too large to display and only a part is printed. *****
[{"id":"03e9bf9d-5fec-4cdc-82a3-19c5fa1c847e","userName":"Utility",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions