fsprojects / FSharp.Json

F# JSON Reflection based serialization library
Apache License 2.0
222 stars 26 forks source link

Is there any fundamental reason why standard .NET collections are not among supported types? #40

Open voroninp opened 3 years ago

voroninp commented 3 years ago

I tried to serilize result returned by C# code - that is List<T> - and got an exception that List is not supported. Just curioius why? =)

vsapronov commented 3 years ago

Hi, some types I could support but keep in mind that competing with Newtonsoft was never a goal of this library. One of the complexities would be provide/not to provide null-safely depending on where type is coming from.

Could you please be more specific about List that you refer to. What is the full name of the class? From quick look at this it seems that List should be supported: https://github.com/vsapronov/FSharp.Json/blob/227a04799cf3216178dcafbc3297ac4b559f194e/FSharp.Json/Reflection.fs#L18-L19 Do you think you could code a little pure F# example where you create instance of List and getting the "not supported" error?

voroninp commented 3 years ago

Sorry, F# calls it ResizeArray that is System.Collections.Generic.List<T>