{"id":14650,"library":"json-api-normalizer","title":"JSON API Normalizer","description":"The `json-api-normalizer` package provides a utility to transform JSON:API compliant response data into a normalized, Redux-friendly format. Unlike general-purpose normalization libraries such as Normalizr, this package directly interprets the JSON:API specification, eliminating the need for manual schema definitions. It converts collections of resources into key-value maps, where keys are resource IDs, making it highly suitable for efficient state management within Redux applications. The current stable version is 1.0.4. Development appears to be largely inactive since 2017, with the last commit on GitHub approximately five years ago, suggesting a potentially abandoned status. Its primary differentiator is its direct, schema-less adherence to the JSON:API specification, providing a simpler setup for compliant APIs.","status":"abandoned","version":"1.0.4","language":"javascript","source_language":"en","source_url":"https://github.com/yury-dymov/json-api-normalizer","tags":["javascript","JSON","API","normalize","redux"],"install":[{"cmd":"npm install json-api-normalizer","lang":"bash","label":"npm"},{"cmd":"yarn add json-api-normalizer","lang":"bash","label":"yarn"},{"cmd":"pnpm add json-api-normalizer","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The primary normalization function is a default export. Attempting to destructure it will result in 'undefined'.","wrong":"import { normalize } from 'json-api-normalizer';","symbol":"normalize","correct":"import normalize from 'json-api-normalizer';"},{"note":"For CommonJS environments, use `require`. The package provides both ESM and CJS entry points for compatibility.","wrong":"import normalize from 'json-api-normalizer';","symbol":"normalize (CommonJS)","correct":"const normalize = require('json-api-normalizer');"}],"quickstart":{"code":"import normalize from 'json-api-normalizer';\n\nconst json = {\n  data: [{\n    \"type\": \"post-block\",\n    \"relationships\": {\n      \"question\": {\n        \"data\": {\n          \"type\": \"question\",\n          \"id\": \"295\"\n        }\n      }\n    },\n    \"id\": \"2620\",\n    \"attributes\": {\n      \"text\": \"I am great!\",\n      \"id\": 2620\n    }\n  }],\n  included: [{\n    \"type\": \"question\",\n    \"id\": \"295\",\n    \"attributes\": {\n      \"text\": \"How are you?\",\n      id: 295\n    }\n  }]\n};\n\nconsole.log(normalize(json));\n/* Expected Output:\n{\n  question: {\n    \"295\": {\n      id: 295,\n      type: \"question\"\n      attributes: {\n        text: \"How are you?\"\n      }\n    }\n  },\n  postBlock: {\n    \"2620\": {\n      id: 2620,\n      type: \"postBlock\",\n      attributes: {\n        text: \"I am great!\"\n      },\n      relationships: {\n        question: {\n          type: \"question\",\n          id: \"295\"\n        }\n      }\n    }\n  }\n}\n*/\n\nconst normalizedWithEndpoint = normalize(json, { endpoint: '/post-block/2620' });\nconsole.log(normalizedWithEndpoint.meta);","lang":"javascript","description":"This example demonstrates how to normalize a JSON:API response, including related 'included' data, and how to use the `endpoint` option to store request-specific metadata."},"warnings":[{"fix":"Consider migrating to a more actively maintained JSON:API client or normalization library, or fork the project for custom maintenance. Thorough testing is required if used in a modern stack.","message":"The `json-api-normalizer` package is effectively abandoned, with its last commit on GitHub occurring approximately five years ago. This means it has not been updated since 2017 and may have significant compatibility issues with modern JavaScript environments, newer Redux versions, or evolving JSON:API specifications.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Manually verify normalization behavior against your specific JSON:API server's response format, especially if your API uses newer JSON:API features or custom extensions.","message":"The library processes JSON:API responses according to the specification prevalent around 2017. Later revisions or extensions to the JSON:API spec (e.g., more complex relationship types, meta object placement) might not be fully supported or normalized as expected.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set `filterEndpoint: false` in the options object if you need distinct metadata entries for different query parameters (e.g., `normalize(json, { endpoint: '/posts?page=1', filterEndpoint: false })`).","message":"By default, query options in the endpoint URL are ignored when storing metadata unless the 'filterEndpoint' option is explicitly set to `false`. This can lead to overwriting cached data if different queries to the same base endpoint return distinct datasets.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Change the import statement to `import normalize from 'json-api-normalizer';`","cause":"Attempting to import `normalize` as a named export (`import { normalize } from '...'`) when it is a default export.","error":"TypeError: json_api_normalizer__WEBPACK_IMPORTED_MODULE_0__.normalize is not a function"},{"fix":"Ensure the `endpoint` option is passed to the `normalize` function with a string value representing the request endpoint, e.g., `normalize(json, { endpoint: '/api/resource' })`.","cause":"The 'endpoint' option was not provided to the `normalize` function, which is necessary for the library to generate the `meta` object in the output.","error":"TypeError: Cannot read properties of undefined (reading 'meta') when trying to access normalized output with meta data"}],"ecosystem":"npm"}