Skip to content

Complete Example #29

@robopeter

Description

@robopeter

Could a complete working example be provided to augment the snippets of examples provided? Specifically I'd really appreciate an example that shows loading a JSON HAL collection into an array of models/objects. Even more specifically I have a JSON file like this that I'd like to create an array of article objects from:

{

  "_links": {
    "self": {
      "href": "/articles/"
    }
  },
  "count": 2,
  "_embedded": {
    "articles": [
      {
        "_links": {
          "self": "/articles/2",
          "collection": "/articles/"
        },
        "size": 7633,
        "comments": [
          "/comments/88",
          "/comments/76",
          "/comments/79",
          "/comments/90",
          "/comments/78",
          "/comments/91"
        ],
        "title": "foo",
        "sha256": "e76a675caadef4d148866d063005550252528792d658cb270bcd1ea287f17261",
        "id": 2
      },
      {
        "_links": {
          "self": "/articles/3",
          "collection": "/articles/"
        },
        "size": 24650,
        "comments": [
          "/comments/100",
          "/comments/94",
          "/comments/93"
        ],
        "title": "bar",
        "sha256": "7b98258260d69da3937342846dc59b4769dda38a49f92a9bf42c302b97299220",
        "id": 3
      }
    ]
  }
}

Otherwise, could complete JSON be provided along side the corresponding existing code examples? Thanks!

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