jsx
jsx copied to clipboard
Allow tuples in input terms with the [tuples_to_lists] option
Allow encoding terms containing tuples with the [tuples_to_lists]
option of the encode
function. Tuples are encoded as lists. No exception is made for the [{}]
and [{k, v}, ...]
special cases, and in the current implementation DateTime objects are also encoded as lists.
The rationale for this pull is that in newer erlang projects structures represeting key -> value pairs generally move from proplists to maps, encode
and decode
functions are not invertible anyway, and transforming manually each and every tuple to list manually before encoding is a tedious job.
Without this option it is fully compatible with previous versions.
I can also add conversion of one-tuple and two-tuple to timestamps, but not sure if this should be default behaviour or a configurable with another paremeter(s) one.
I'd add that this pull is not ready for getting accepted yet until I add support for datetimes and some tests. It's here for discussing about whether should it be accepted or not.
You can convert this to a draft if you think it better signals your intention.