{"id":42281,"library":"vuex-orm-json-api","title":"Vuex ORM JSON:API","description":"A JSON:API adapter for Vuex ORM that transforms JSON:API documents into Vuex ORM records, attributes, and relations. Version 1.0.0 (stable). It extends the Vuex ORM Axios plugin with RESTful actions (index, show, create, update, destroy) and handles JSON:API's primary data and included resources via upsert (insertOrUpdate). Key differentiators: automatic relationship resolution, configurable resource-to-entity case conversion, rawRequest API for accessing meta/links, and pass-through axios options. Requires @vuex-orm/core >=0.36.0 and a Vuex ORM Axios plugin. Release cadence is not specified but appears stable.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/scalient/vuex-orm-json-api","tags":["javascript","vue","vuex","vuex-plugin","vuex-orm","vuex-orm-plugin","axios","json-api"],"install":[{"cmd":"npm install vuex-orm-json-api","lang":"bash","label":"npm"},{"cmd":"yarn add vuex-orm-json-api","lang":"bash","label":"yarn"},{"cmd":"pnpm add vuex-orm-json-api","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required for Vuex ORM model definitions and plugin system.","package":"@vuex-orm/core","optional":false}],"imports":[{"note":"Default export for plugin installation. CJS require works but ESM is preferred.","wrong":"const VuexOrmJsonApi = require('vuex-orm-json-api')","symbol":"VuexOrmJsonApi","correct":"import VuexOrmJsonApi from 'vuex-orm-json-api'"},{"note":"Named export; must be destructured.","wrong":"import RestfulActionsMixin from 'vuex-orm-json-api'","symbol":"RestfulActionsMixin","correct":"import { RestfulActionsMixin } from 'vuex-orm-json-api'"},{"note":"jsonApi() is a method on Vuex ORM Model subclasses, not imported separately.","wrong":"User.jsonApi().index() // Incorrect: missing method call","symbol":"Model.jsonApi()","correct":"User.jsonApi().index()"}],"quickstart":{"code":"import axios from 'axios';\nimport VuexORM from '@vuex-orm/core';\nimport VuexOrmJsonApi, { RestfulActionsMixin } from 'vuex-orm-json-api';\n\nVuexORM.use(VuexOrmJsonApi, { axios, mixins: [RestfulActionsMixin] });\n\nclass User extends VuexORM.Model {\n  static entity = 'users';\n  static fields() {\n    return {\n      id: this.attr(null),\n      name: this.attr('')\n    };\n  }\n}\n\nVuexORM.registerEntities({ User });\n\n// Usage example\nasync function fetchUsers() {\n  const users = await User.jsonApi().index();\n  console.log(users); // array of upserted User records\n}","lang":"javascript","description":"Install the plugin, define a User model, and call RESTful action index() to fetch users from the server."},"warnings":[{"fix":"Ensure you call VuexORM.use(VuexOrmJsonApi, { axios, mixins: [RestfulActionsMixin] }) before using jsonApi().","message":"The jsonApi() method is only available after registering the plugin with VuexORM.use() and including RestfulActionsMixin in mixins option.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Set jsonApiConfig.entityToResourceRouteCase or resourceToEntityCase on your model or during registration.","message":"JSON:API resource casing conversion defaults to kebab-to-snake for entities; your API must match or config resourceToEntityCase.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Do not expect a record from destroy(); it returns null after successful deletion.","message":"The destroy action returns null, not the deleted record. Misunderstanding return value may cause errors.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'/core':82 '0.36.0':83 '1.0.0':25 'access':70 'action':36 'adapt':8 'api':4,7,15,45,68,114 'appear':96 'attribut':21 'automat':57 'axio':32,76,88,111 'cadenc':91 'case':65 'configur':60 'convers':66 'creat':39 'data':48 'destroy':41 'differenti':56 'document':16 'entiti':64 'extend':28 'handl':43 'includ':50 'index':37 'insertorupd':54 'javascript':98 'json':3,6,14,44,113 'json-api':112 'key':55 'meta/links':71 'option':77 'orm':2,11,19,31,81,87,106,109 'pass':74 'pass-through':73 'plugin':33,89,103,110 'primari':47 'rawrequest':67 'record':20 'relat':23 'relationship':58 'releas':90 'requir':78 'resolut':59 'resourc':51,62 'resource-to-ent':61 'rest':35 'show':38 'specifi':94 'stabl':26,97 'transform':13 'updat':40 'upsert':53 'version':24 'via':52 'vue':99 'vuex':1,10,18,30,80,86,100,102,105,108 'vuex-orm':79,104 'vuex-orm-plugin':107 'vuex-plugin':101","created_at":"2026-06-04T18:56:29.701877+00:00","updated_at":"2026-06-04T18:56:29.701877+00:00","problems":[{"fix":"Use 'import VuexOrmJsonApi from 'vuex-orm-json-api'' (default import) and pass as first argument to VuexORM.use().","cause":"Importing VuexOrmJsonApi incorrectly (e.g., misspelled or wrong default).","error":"Error: VuexORM.use() must be called with a plugin object or function"},{"fix":"Add mixins: [RestfulActionsMixin] to the options object passed to VuexORM.use().","cause":"RestfulActionsMixin not included in mixins array during plugin registration.","error":"TypeError: User.jsonApi is not a function"},{"fix":"Install axios: npm install axios","cause":"Missing axios dependency which is required for HTTP requests.","error":"Error: Cannot find module 'axios'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/scalient/vuex-orm-json-api#readme","github":"https://github.com/scalient/vuex-orm-json-api","docs":null,"changelog":null,"pypi":null,"npm":"vuex-orm-json-api","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}