Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1
Normalize your JSON:API response
License
NotificationsYou must be signed in to change notification settings
guillaumebriday/json-api-response-converter
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
- Very small
- No dependencies
- Easy to use
- Compatible withVuex ORM
$ npm install json-api-response-converter --save# or$ yarn add json-api-response-converterimportJsonApiResponseConverterfrom'json-api-response-converter'constresponse={data:[{id:'1',type:'articles',attributes:{title:'This project is awesome'},relationships:{author:{data:{id:'1',type:'author'}},comments:{data:[{id:'1',type:'comment'},{id:'2',type:'comment'}]}}}],included:[{id:'1',type:'author',attributes:{name:'Anakin'}},{id:'1',type:'comment',attributes:{body:'First!'}},{id:'2',type:'comment',attributes:{body:'Second!'}}]}constdata=newJsonApiResponseConverter(response).formattedResponseconsole.log(data)/**[ { id: 1, title: 'This project is awesome', author: { id: 1, name: 'Anakin' }, comments: [ { id: 1, body: 'First!' }, { id: 2, body: 'Second!' } ] }]*/
Many edges cases are tested in thetests folder
$ git clone https://github.com/guillaumebriday/json-api-response-converter$cd json-api-response-converter$ yarn# or npm install
You can run tests withJest:
$ yarntest# or npm run test
Check the syntax withESLint:
$ yarn lint
Do not hesitate to contribute to the project by adapting or adding features ! Bug reports or pull requests are welcome.
Inspired by:
The gem is available as open source under the terms of theMIT License.
About
Normalize your JSON:API response
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.