{"id":24391815,"url":"https://github.com/carlobeltrame/hal-json-normalizer","last_synced_at":"2025-09-04T15:39:15.952Z","repository":{"id":35079370,"uuid":"203820513","full_name":"carlobeltrame/hal-json-normalizer","owner":"carlobeltrame","description":"Normalizes responses from HAL JSON APIs for use in Vuex, redux and similar state stores.","archived":false,"fork":false,"pushed_at":"2025-08-22T23:06:46.000Z","size":1753,"stargazers_count":4,"open_issues_count":15,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-28T12:30:44.814Z","etag":null,"topics":["hal-json","hal-json-normalizer","normalizer","redux","uris","vuex"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/carlobeltrame.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-08-22T15:15:45.000Z","updated_at":"2025-08-22T23:06:09.000Z","dependencies_parsed_at":"2024-01-08T20:27:12.811Z","dependency_job_id":"9f449daf-16f5-447a-af5a-097adc9edb36","html_url":"https://github.com/carlobeltrame/hal-json-normalizer","commit_stats":{"total_commits":381,"total_committers":8,"mean_commits":47.625,"dds":"0.38845144356955386","last_synced_commit":"bdffd1c5a3f5f4bc462ced79bea07ac453b1a134"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/carlobeltrame/hal-json-normalizer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carlobeltrame%2Fhal-json-normalizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carlobeltrame%2Fhal-json-normalizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carlobeltrame%2Fhal-json-normalizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carlobeltrame%2Fhal-json-normalizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/carlobeltrame","download_url":"https://codeload.github.com/carlobeltrame/hal-json-normalizer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carlobeltrame%2Fhal-json-normalizer/sbom","scorecard":{"id":265986,"data":{"date":"2025-08-11","repo":{"name":"github.com/carlobeltrame/hal-json-normalizer","commit":"45f826886c7a87141b01402a486dd133fbf44129"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.9,"checks":[{"name":"Maintained","score":2,"reason":"3 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/carlobeltrame/hal-json-normalizer/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/carlobeltrame/hal-json-normalizer/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/carlobeltrame/hal-json-normalizer/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/carlobeltrame/hal-json-normalizer/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:49: update your workflow using https://app.stepsecurity.io/secureworkflow/carlobeltrame/hal-json-normalizer/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:58: update your workflow using https://app.stepsecurity.io/secureworkflow/carlobeltrame/hal-json-normalizer/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:61: update your workflow using https://app.stepsecurity.io/secureworkflow/carlobeltrame/hal-json-normalizer/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:65: update your workflow using https://app.stepsecurity.io/secureworkflow/carlobeltrame/hal-json-normalizer/ci.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:31","Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:73","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned","Info:   0 out of   2 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 1 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":2,"reason":"8 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T12:03:25.494Z","repository_id":35079370,"created_at":"2025-08-17T12:03:25.494Z","updated_at":"2025-08-17T12:03:25.494Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273632425,"owners_count":25140766,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hal-json","hal-json-normalizer","normalizer","redux","uris","vuex"],"created_at":"2025-01-19T17:42:41.333Z","updated_at":"2025-09-04T15:39:15.904Z","avatar_url":"https://github.com/carlobeltrame.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hal-json-normalizer\n\nUtility to normalize HAL JSON data for Vuex applications.\n\n[![npm version](https://img.shields.io/npm/v/hal-json-normalizer.svg?style=flat)](https://www.npmjs.com/package/hal-json-normalizer)\n[![Downloads](http://img.shields.io/npm/dm/hal-json-normalizer.svg?style=flat-square)](https://npmjs.org/package/hal-json-normalizer)\n[![CI](https://github.com/carlobeltrame/hal-json-normalizer/workflows/CI/badge.svg)](https://github.com/carlobeltrame/hal-json-normalizer/actions?query=workflow%3ACI)\n[![Coverage Status](https://coveralls.io/repos/github/carlobeltrame/hal-json-normalizer/badge.svg?branch=master)](https://coveralls.io/github/carlobeltrame/hal-json-normalizer?branch=master)\n\n# Description\n\nhal-json-normalizer helps [HAL JSON](https://tools.ietf.org/html/draft-kelly-json-hal-08) APIs and [Vuex](https://vuex.vuejs.org/) work together.\nUnlike [normalizr](https://github.com/paularmstrong/normalizr), hal-json-normalizer supports the HAL+JSON specification, which means that you don't have to care about schemas.\nThis library also supports [templated links](https://tools.ietf.org/html/draft-kelly-json-hal-00#section-5).\n\n# Install\n\n```shell\n$ npm install hal-json-normalizer\n```\n\n# Example\n\n```JavaScript\nimport normalize from 'hal-json-normalizer';\n\nconst json = {\n  id: 2620,\n  text: 'I am great!',\n  _embedded: {\n    question: {\n      id: 295,\n      text: 'How are you?',\n      _links: {\n        self: {\n          href: 'https://my.api.com/questions/295',\n        },\n      },\n    },\n  },\n  _links: {\n    self: {\n      href: 'https://my.api.com/answers/2620',\n    },\n    author: {\n      href: 'https://my.api.com/users/1024',\n    },\n    questions: {\n      href: 'https://my.api.com/questions{/id}',\n      templated: true,\n    },\n  },\n};\n\nconsole.log(normalize(json));\n/* Output:\n{\n  'https://my.api.com/answers/2620': {\n    id: 2620,\n    text: 'I am great!'\n    question: {\n      href: 'https://my.api.com/questions/295',\n    },\n    author: {\n      href: 'https://my.api.com/users/1024',\n    },\n    questions: {\n      href: 'https://my.api.com/questions{/id}',\n      templated: true,\n    },\n    _meta: {\n      self: 'https://my.api.com/answers/2620',\n    },\n  },\n  'https://my.api.com/questions/295': {\n    id: 295,\n    text: 'How are you?',\n    _meta: {\n      self: 'https://my.api.com/questions/295',\n    },\n  },\n}\n*/\n```\n\n# Options\n\n## Camelize Keys\n\nBy default all object keys are converted to camel case, however, you can disable this with `camelizeKeys` option.\n\n```JavaScript\nconst json = {\n  'camel-me': 1,\n  _links: {\n    self: {\n      href: 'https://my.api.com/someEntity/1',\n    },\n  },\n};\n\nconsole.log(normalize(json));\n/* Output:\n{\n  'https://my.api.com/someEntity/1': {\n    camelMe: 1,\n    _meta: {\n      self: 'https://my.api.com/someEntity/1',\n    },\n  },\n}\n*/\n\nconsole.log(normalize(json, { camelizeKeys: false }));\n/* Output:\n{\n  'https://my.api.com/someEntity/1': {\n    'camel-me': 1,\n    _meta: {\n      self: 'https://my.api.com/someEntity/1',\n    },\n  },\n}\n*/\n```\n\n\n## Normalizing URIs\n\nIn many cases, all API URIs will start with the same prefix, or you may want to treat different orderings of query parameters as the same endpoint, etc. You can specify a normalization strategy for all identifiers by passing a function to the `normalizeUri` option.\n\n\u003e Note: [Templated links](https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.1) are excluded from normalization, because the URIs inside are actually [URI templates](https://tools.ietf.org/html/rfc6570), not normal URIs. Templated links look like this: `{ href: 'https://so.me/where{/id}', templated: true }`\n\n```JavaScript\nconst json = {\n  id: 1,\n  _links: {\n    self: {\n      href: 'https://my.api.com/api/v2/someEntity/1',\n    },\n    someApiInternalLink: {\n      href: 'https://my.api.com/api/v2/related/20',\n    },\n    someExternalLink: {\n      href: 'test.com/not-starting-with-the-same-prefix',\n    },\n  },\n};\n\nconsole.log(normalize(json));\n/* Output:\n{\n  'https://my.api.com/api/v2/someEntity/1': {\n    id: 1,\n    someApiInternalLink: {\n      href: 'https://my.api.com/api/v2/related/20',\n    },\n    someExternalLink: {\n      href: 'test.com/not-starting-with-the-same-prefix',\n    },\n    _meta: {\n      self: 'https://my.api.com/someEntity/1',\n    },\n  },\n}\n*/\n\nconsole.log(normalize(json, { normalizeUri: (uri) =\u003e uri.replace(/^https:\\/\\/my.api.com\\/api\\/v2/, '') }));\n/* Output:\n{\n  '/someEntity/1: {\n    id: 1,\n    someApiInternalLink: {\n      href: '/related/20',\n    },\n    someExternalLink: {\n      href: 'test.com/not-starting-with-the-same-prefix',\n    },\n    _meta: {\n      self: '/someEntity/1',\n    },\n  },\n}\n*/\n```\n\n\n## Custom `_meta` key\n\nThis library adds the self link as a string property `self` to the `_meta` property of each resource. Depending on your API server framework, you might want to use a different key than `_meta`. You can change this using the `metaKey` option.\n\n```JavaScript\nconst json = {\n  id: 1,\n  _meta: {\n    expiresAt: 1513868982,\n  },\n  _links: {\n    self: {\n      href: 'https://my.api.com/someEntity/1',\n    },\n  },\n};\n\nconsole.log(normalize(json));\n/* Output:\n{\n  'https://my.api.com/someEntity/1': {\n    id: 1,\n    _meta: {\n      expiresAt: 1513868982,\n      self: 'https://my.api.com/someEntity/1',\n    },\n  },\n}\n*/\n\nconsole.log(normalize(json, { metaKey: '__metadata' }));\n/* Output:\n{\n  'https://my.api.com/someEntity/1': {\n    id: 1,\n    // CAUTION: this key is now now special anymore and therefore is camelized by default\n    meta: {\n      expiresAt: 1513868982,\n    },\n    __metadata: {\n      self: 'https://my.api.com/someEntity/1',\n    },\n  },\n}\n*/\n```\n\n\n## Embedded lists with a self link\n\nIn some cases your API might need to embed a list (for performance reasons), but still communicate a self link under which the list can be separately re-fetched. This is supported by doing the following:\n* In the API, embed the list normally under some relation key (e.g. `comments`) and also add a link with the same relation key to `_links`\n* Set the `embeddedStandaloneListKey` option to some string, e.g. `'items'`\n\nThe list will then be normalized as a separate (standalone) object, containing just the list under the key from the option (`items`).\n\n\u003e Note: If you don't specify the `embeddedStandaloneListKey` option and the API sends the same relation key in `_embedded` and in `_links`, the data from `_embedded` will take preference, since that can potentially contain more information.\n\n```JavaScript\nconst json = {\n  id: 1,\n  _embedded: {\n    comments: [\n      {\n        text: 'Hello World!',\n        author: 'James',\n        _links: {\n          self: {\n            href: 'https://my.api.com/comments/53204',\n          },\n        },\n      },\n      {\n        text: 'Hi there',\n        author: 'Joana',\n        _links: {\n          self: {\n            href: 'https://my.api.com/comments/1395',\n          },\n        },\n      },\n    ],\n  },\n  _links: {\n    comments: {\n      href: 'https://my.api.com/comments?someEntity=1',\n    },\n    self: {\n      href: 'https://my.api.com/someEntity/1',\n    },\n  },\n};\n\nconsole.log(normalize(json));\n/* Output:\n{\n  'https://my.api.com/someEntity/1': {\n    id: 1,\n    comments: [\n      {\n        href: 'https://my.api.com/comments/53204',\n      },\n      {\n        href: 'https://my.api.com/comments/1395',\n      },\n    ],\n    _meta: {\n      self: 'https://my.api.com/someEntity/1',\n    },\n  },\n  'https://my.api.com/comments/53204': {\n    text: 'Hello World!',\n    author: 'James',\n    _meta: {\n      self: 'https://my.api.com/comments/53204'\n    },\n  }\n  'https://my.api.com/comments/1395': {\n    text: 'Hi there',\n    author: 'Joana',\n    _meta: {\n      self: 'https://my.api.com/comments/1395'\n    },\n  },\n}\n*/\n\nconsole.log(normalize(json, { embeddedStandaloneListKey: 'items' }));\n/* Output:\n{\n  'https://my.api.com/someEntity/1': {\n    id: 1,\n    comments: {\n      href: 'https://my.api.com/comments?someEntity=1',\n    },\n    _meta: {\n      self: 'https://my.api.com/someEntity/1',\n    },\n  },\n  'https://my.api.com/comments?someEntity=1': {\n    items: [\n      {\n        href: 'https://my.api.com/comments/53204',\n      },\n      {\n        href: 'https://my.api.com/comments/1395',\n      },\n    ],\n    _meta: {\n      self: 'https://my.api.com/comments?someEntity=1',\n    },\n  },\n  'https://my.api.com/comments/53204': {\n    text: 'Hello World!',\n    author: 'James',\n    _meta: {\n      self: 'https://my.api.com/comments/53204'\n    },\n  }\n  'https://my.api.com/comments/1395': {\n    text: 'Hi there',\n    author: 'Joana',\n    _meta: {\n      self: 'https://my.api.com/comments/1395'\n    },\n  },\n}\n*/\n```\n\n## Virtual self link for embedded collections without link\n\nFor consistency, you might want to always have related collections referenceable, even if the API does not provide any single link under which the collection could be accessed in isolation.\nThis library gives you the option to generate virtual keys (virtual URIs, virtual self links) for all embedded and linked arrays that don't already have a self link.\nTo activate, set `virtualSelfLinks` to `true`.\n\n\u003e Note: If the API also sends a single link for an embedded collection, this single link will be used instead of any virtual (generated) key, since that link will be more accurate and more useful to e.g. reload the collection from the API in isolation.\n\nThe generated links are always marked with the `virtual: true` flag, so you can distinguish them from \"normal\" self links when doing further processing.\n\n```JavaScript\nconst json = {\n  id: 1,\n  _embedded: {\n    comments: [\n      {\n        text: 'Hello World!',\n        author: 'James',\n        _links: {\n          self: {\n            href: 'https://my.api.com/comments/53204',\n          },\n        },\n      },\n      {\n        text: 'Hi there',\n        author: 'Joana',\n        _links: {\n          self: {\n            href: 'https://my.api.com/comments/1395',\n          },\n        },\n      },\n    ],\n  },\n  _links: {\n    users: [{\n      href: 'https://my.api.com/users/123',\n    }, {\n      href: 'https://my.api.com/users/324',\n    }],\n    self: {\n      href: 'https://my.api.com/someEntity/1',\n    },\n  },\n};\n\nconsole.log(normalize(json, { embeddedStandaloneListKey: 'items', virtualSelfLinks: true }));\n/* Output:\n{\n  'https://my.api.com/someEntity/1': {\n    id: 1,\n    comments: {\n      href: 'https://my.api.com/someEntity/1#comments',\n      virtual: true,\n    },\n    users: {\n      href: 'https://my.api.com/someEntity/1#users',\n      virtual: true,\n    },\n    _meta: {\n      self: 'https://my.api.com/someEntity/1',\n    },\n  },\n  'https://my.api.com/someEntity/1#comments': {\n    items: [\n      {\n        href: 'https://my.api.com/comments/53204',\n      },\n      {\n        href: 'https://my.api.com/comments/1395',\n      },\n    ],\n    _meta: {\n      self: 'https://my.api.com/someEntity/1#comments',\n      virtual: true,\n      owningResource: 'https://my.api.com/someEntity/1',\n      owningRelation: 'comments',\n    },\n  },\n  'https://my.api.com/someEntity/1#users': {\n    items: [\n      {\n        href: 'https://my.api.com/users/123',\n      },\n      {\n        href: 'https://my.api.com/users/324',\n      },\n    ],\n    _meta: {\n      self: 'https://my.api.com/someEntity/1#users',\n      virtual: true,\n      owningResource: 'https://my.api.com/someEntity/1',\n      owningRelation: 'comments',\n    },\n  },\n  'https://my.api.com/comments/53204': {\n    text: 'Hello World!',\n    author: 'James',\n    _meta: {\n      self: 'https://my.api.com/comments/53204'\n    },\n  }\n  'https://my.api.com/comments/1395': {\n    text: 'Hi there',\n    author: 'Joana',\n    _meta: {\n      self: 'https://my.api.com/comments/1395'\n    },\n  },\n}\n*/\n```\n\n## Filtering references\n\nEven if the HAL JSON standard does not define it this way, some API server frameworks (like apigility in the Zend Framework 2) can sometimes send stripped down versions of deeply nested embedded resources. As you can see below (the `author` of the comment resource), such references contain nothing but a self link. You can prevent these incomplete resource representations from polluting your store using the `filterReferences` option.\n\n```JavaScript\nconst json = {\n  id: 1,\n  text: 'hello, world!',\n  _embedded: {\n    comments: [\n      {\n        id: 203,\n        text: 'good post!',\n        _embedded: {\n          // This is a reference: an embedded resource with nothing but a self link\n          author: {\n            _links: {\n              self: {\n                href: 'https://my.api.com/users/124',\n              },\n            },\n          },\n        },\n        _links: {\n          self: {\n            href: 'https://my.api.com/comments/203',\n          },\n        },\n      },\n    ],\n  },\n  _links: {\n    self: {\n      href: 'https://my.api.com/posts/1',\n    },\n  },\n};\n\nconsole.log(normalize(json));\n/* Output:\n{\n  'https://my.api.com/posts/1': {\n    id: 1,\n    text: 'hello, world!',\n    comments: [\n      {\n        href: 'https://my.api.com/comments/203',\n      },\n    ],\n    _meta: {\n      self: 'https://my.api.com/posts/1',\n    },\n  },\n  'https://my.api.com/comments/203': {\n    id: 203,\n    text: 'good post!',\n    author: 'https://my.api.com/users/124',\n    _meta: {\n      self: 'https://my.api.com/comments/203',\n    },\n  },\n  // This is an incomplete representation of the user, use filterResources: true if you don't want this:\n  'https://my.api.com/users/124': {\n    _meta: {\n      self: 'https://my.api.com/users/124',\n    },\n  },\n}\n*/\n\nconsole.log(normalize(json, { filterReferences: true }));\n/* Output:\n{\n  'https://my.api.com/posts/1': {\n    id: 1,\n    text: 'hello, world!',\n    comments: [\n      {\n        href: 'https://my.api.com/comments/203',\n      },\n    ],\n    _meta: {\n      self: 'https://my.api.com/posts/1',\n    },\n  },\n  'https://my.api.com/comments/203': {\n    id: 203,\n    text: 'good post!',\n    author: 'https://my.api.com/users/124',\n    _meta: {\n      self: 'https://my.api.com/comments/203',\n    },\n  },\n}\n*/\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarlobeltrame%2Fhal-json-normalizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarlobeltrame%2Fhal-json-normalizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarlobeltrame%2Fhal-json-normalizer/lists"}