vt-elixir / ja_serializer

JSONAPI.org Serialization in Elixir.
Other
640 stars 148 forks source link

Allow JSON objects and arrays as attributes #208

Closed pinx closed 5 years ago

pinx commented 7 years ago

The JSON-API allows putting child objects in attributes

Complex data structures involving JSON objects and arrays are allowed as attribute values.

JaSerializer runs into an error in Poison.encode: unable to encode {nil, "comments"} Poison can serialize maps, so it seems a matter of handing it over from JaSerializer.

alanpeabody commented 7 years ago

Anything not explicitly implemented here is passed as is to Poison: https://github.com/vt-elixir/ja_serializer/blob/master/lib/ja_serializer/formatter.ex.

While Poison does encode maps, I do not believe it will encode tuples (which is what your example shows) as there isn't really a JS equivalent.