sile / jsone

Erlang JSON library
MIT License
291 stars 71 forks source link

Don't try to encode singleton tuples as objects. #55

Closed Flameeyes closed 3 years ago

Flameeyes commented 3 years ago

Previously, trying to encode any tuples with a single value inside causes a badarg to be raised, as it's being interpreted as an "object", which is expected to be a list of pairs instead.

Other tuples are already let fall through to the unknown value head, which calls the map_unknown_value callback, if provided.

This change makes it so that single-value tuples (singleton tuples) are also let fall through, so that they can be handled by the callback, so that they become the caller's responsibility to encode.