https://github.com/jsonapi-rb/jsonapi-parser
Validate JSON API documents.
https://github.com/jsonapi-rb/jsonapi-parser
api deserialization json json-api jsonapi jsonapi-rb validation
Last synced: about 1 month ago
JSON representation
Validate JSON API documents.
- Host: GitHub
- URL: https://github.com/jsonapi-rb/jsonapi-parser
- Owner: jsonapi-rb
- License: mit
- Created: 2016-10-26T01:47:08.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-09T01:25:47.000Z (almost 7 years ago)
- Last Synced: 2025-03-29T03:32:01.972Z (about 2 months ago)
- Topics: api, deserialization, json, json-api, jsonapi, jsonapi-rb, validation
- Language: Ruby
- Homepage: http://jsonapi-rb.org
- Size: 8.79 KB
- Stars: 27
- Watchers: 3
- Forks: 10
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jsonapi-parser
Ruby gem for validating [JSON API](http://jsonapi.org) documents.## Status
[](https://badge.fury.io/rb/jsonapi-parser)
[](http://travis-ci.org/jsonapi-rb/parser?branch=master)
[](https://codecov.io/gh/jsonapi-rb/parser)
[](https://gitter.im/jsonapi-rb/Lobby)## Resources
* Chat: [gitter](http://gitter.im/jsonapi-rb)
* Twitter: [@jsonapirb](http://twitter.com/jsonapirb)
* Docs: [jsonapi-rb.org](http://jsonapi-rb.org)## Installation
```ruby
# In Gemfile
gem 'jsonapi-parser'
```
then
```
$ bundle
```
or manually via
```
$ gem install jsonapi-parser
```## Usage
First, require the gem:
```ruby
require 'jsonapi/parser'
```
Then simply parse a document:
```ruby
# This will raise JSONAPI::Parser::InvalidDocument if an error is found.
JSONAPI.parse_response!(document_hash)
```
or a resource create/update payload:
```ruby
JSONAPI.parse_resource!(document_hash)
```
or a relationship update payload:
```ruby
JSONAPI.parse_relationship!(document_hash)
```## License
jsonapi-parser is released under the [MIT License](http://www.opensource.org/licenses/MIT).