Skip to content

How to Include Links when Serializing? #126

@falestra

Description

@falestra

I'm building an API with ASP.NET Core 3.1, with an example model like this:

public class Article
{
    public string Id { get; set; }
    public string Title { get; set; }
    public List<Comment> Comments { get; set; }
}

public class Comment
{
    public string Id { get; set; }
    public string Body { get; set; }
}

The controller contains something like this:

var articles = await articleService.GetAsync(); // Get All Articles
return Json(articles, new JsonApiSerializerSettings());

How do I get the response from the controller to have Links?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions