diff --git a/_config.yml b/_config.yml index 0867b0c27..afa278967 100644 --- a/_config.yml +++ b/_config.yml @@ -23,6 +23,8 @@ navigation: url: /extensions/ - title: Recommendations url: /recommendations/ +- title: Examples + url: /examples/ - title: Implementations url: /implementations/ - title: FAQ diff --git a/examples/index.md b/examples/index.md new file mode 100644 index 000000000..b9af89212 --- /dev/null +++ b/examples/index.md @@ -0,0 +1,49 @@ +--- +layout: page +title: Examples +--- + +This page contains additional examples of how to apply various parts of the specification. + +### Complex Attributes + +The following resource object represents an invoice and contains three [complex +attributes](/format/#document-structure-resource-object-complex-attributes): +`notes`, `total`, and `customer-references`. + +```json +{ + "type": "invoices", + "id": "1234", + "date": "2015-02-14", + "due": "2015-03-14", + "notes": ["Lorem ipsum dolor sit amet", "Consectetuer adipiscing elit"], + "total": { + "currency": "EUR", + "line-items": 3000.00, + "discounts": 150.00, + "tax": { + "tax-type": "VAT", + "taxable-amount": 2850.00, + "tax-amount": 570.00 + }, + "amount-payable": 3420.00 + }, + "customer-references": [{ + "ref-type": "purchase-order", + "text": "AB3210" + }, { + "ref-type": "other", + "text": "Department XYZ" + }], + "links": { + "customer": { + "related": "http://example.com/invoices/1234/customer" + }, + "line-items": { + "related": "http://example.com/invoices/1234/line-items" + } + } +} +``` + diff --git a/format/index.md b/format/index.md index 7a77e80bd..5ed72b59c 100644 --- a/format/index.md +++ b/format/index.md @@ -189,10 +189,12 @@ be represented under the "links object". #### Complex Attributes -"[Complex attributes]" are [attributes] whose value is an object or array with -any level of nesting. An object that constitutes or is contained in a complex -attribute **MUST** reserve the `id`, `type`, `links`, and `meta` members for future -use. +"[Complex attributes]" are [attributes] whose value is an object or array +([example](/examples/#complex-attributes)). + +JSON API permits embedding arbitrary data structures as complex attributes in +resource objects. However, any object in a complex attribute **MUST** reserve +the `id`, `type`, `links`, and `meta` members for future use. #### Fields pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy