Closed iskandersierra closed 7 years ago
Hi @iskandersierra and thanks for your contribution. The behaviour you're seeing is by design, since the focus of this library is object transmission across homogenous .NET clusters. It is not intended for deserializing arbitrary json or xml.
Hi @eiriktsarpalis. So are you recommending me not to use FsPickler for parsing input Http/TCP text/binary data?
I'm developing a project where messages are described by some configuration, among others a Pickler
By the way I love the simplicity of the Pickler concept. I just tought that parsing could be another role it could assume easily.
I would not recommend it, no. FsPickler expects a specific format when deserializing and will blow up if that format is not respected with no flexibility wrt version tolerance. The pickler pattern is more general than this implementation though, there could be different pickler libraries designed with your requirements in mind.
I see, thanks for the quick feedback. It has been very clarifying on the concept of the purpose of the library. A parser would be mostly a one way function from binary/text to 'T Option
(or some other richer result). The Pickler in this lib is intended to be reversible on purpose.
Do you have suggestions on other libraries for this purpose (FParsec
is too broad in purpose but too specific for strings). I would like someting like parse: ReadState -> ParseResult<'T>
where ReadState abstract the undelying support (text, bin) and ParseResult allowed for partial readings, format errors to be collected.
@iskandersierra I think Newtonsoft is your safest bet for such an application.
I detected this case where an integer failed to be recognized as a double. Tried to fix it in this PR. I dont know if the same case would apply to XML or binary formatters.