Sparse fieldsets enable a client to request only certain fields (attributes or relationships) to reduce data transfer from server to client. When constructing a document, you can optionally provide a mapping from resource type to a list of fields that you are interested in for this type:
const sparseFields = {
articles: ['author'],
people: ['first-name', 'last-name']
};
const articleDoc = await JsonApi.Document.fromURL(new URL('http://example.com/articles/1'), context, sparseFields);
const article = articleDoc.resource;
const author = await article.relatedResource['author'];
If the server also implements sparse fieldsets, the article
resource will contain only the author relationship (and no attributes) and the author resource will contain only the first-name and last-name attributes (and no relationships).