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

JSON to Bencode issues? #93

Open
trantor opened this issue May 25, 2021 · 0 comments
Open

JSON to Bencode issues? #93

trantor opened this issue May 25, 2021 · 0 comments

Comments

@trantor
Copy link

trantor commented May 25, 2021

Hello @jzelinskie

I've been working with the JSON to Bencode conversion, but there are things that don't seem to make sense to me.
I was looking at how your tool handled things such as null values or booleans when converting to bencode (that doesn't have those types) and this is what came up.

$ faq -n -f json -o bencode '[1,null,2]'
l1:11:2e

# Why are integers converted to strings??? And I thought that null values would be converted to an empty string, for instance. Here they just disappear... which would mess up the length of the list.

$ faq -n -f json -o bencode '{a:null}'
de

# Entire pairs disappearing, although it could make some degree of sense

$  faq -n -f json -o bencode '[true,false]'
li1ei0ee

# Ok now that is something I expected

Now... is there a way to choose how these conversions take place, for instance how a false in JSON would convert to Bencode, for instance as an empty string rather than a 0?

Thanks in advance

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

No branches or pull requests

1 participant