Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added encoding function for tuple datatype #211

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

muralidharan3194
Copy link

Encoding tuple using Poison:

  • Converted the tuple to List using Tuple.to_list({1, 2.5,:atom , ‘string’}) operation then encoded the list using lists:foldr erlang function for iteration, which iterates in reverse order and each iterated value is encoded using respective encoding datatype function.

Input given:
image

output:
Screenshot from 2023-02-13 12-21-48

@muralidharan3194 muralidharan3194 marked this pull request as ready for review March 2, 2023 08:53
@azizk
Copy link

azizk commented Aug 12, 2024

I'm curious how this is meaningful, because in JSON there is no tuple data type. Could you describe a concrete use case for this?

In any case, it's always possible to implement the Poison.Encoder protocol in your own projects. It doesn't seem warranted to include this in Poison itself, although a discussion could be had if tuples were to be encoded as lists by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants