fast_jsonapi icon indicating copy to clipboard operation
fast_jsonapi copied to clipboard

#serialized_json for empty collection

Open jji-fieldwire opened this issue 5 years ago • 1 comments

Hi,

Behavior for serializer passed empty collection is to return nil

I think it would make more sense for the serializer to return []. Ideally would work with empty Array and empty Relation.

##### Current behavior
UserSerializer.new([]).serialized_json
=> nil

##### Desired behavior(?)
UserSerializer.new(User.where.not(id: nil)).serialized_json
=> "[]"

jji-fieldwire avatar Jun 09 '20 22:06 jji-fieldwire

https://github.com/Netflix/fast_jsonapi/issues/462

davidwparker avatar Aug 03 '20 01:08 davidwparker