Closed Rio517 closed 7 years ago
Perhaps I'm using this incorrectly. I would imagine JSONAPI.parse_response!(payload) returns a parsed response. If I open up IRB, this is what I see.
JSONAPI.parse_response!(payload)
require 'jsonapi/parser' #taken from specs payload = {'data' => [{'type' => 'articles', 'id' => '1', 'attributes' => { 'title' => 'JSON API paints my bikeshed!' }, 'links' => { 'self' => 'http://example.com/articles/1' }, 'relationships' => {'author' => {'links' => {'self' => 'http://example.com/articles/1/relationships/author', 'related' => 'http://example.com/articles/1/author'}, 'data' => { 'type' => 'people', 'id' => '9' } }, 'journal' => {'data' => nil }, 'comments' => {'links' => {'self' => 'http://example.com/articles/1/relationships/comments', 'related' => 'http://example.com/articles/1/comments'}, 'data' => [{ 'type' => 'comments', 'id' => '5' }, { 'type' => 'comments', 'id' => '12' } ] } } } ], 'meta' => { 'count' => '13' } } irb(main):005:0> JSONAPI.parse_response!(payload) => nil
Hi @Rio517 – at the moment the parser simply ensures syntactic validity, but provides no API to query the document.
Got it. Thanks!
Perhaps I'm using this incorrectly. I would imagine
JSONAPI.parse_response!(payload)
returns a parsed response. If I open up IRB, this is what I see.