faq
faq copied to clipboard
JSON to Bencode issues?
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