Thoth.Json icon indicating copy to clipboard operation
Thoth.Json copied to clipboard

Explore if it is possible to not alias obj on Fable version

Open MangelMaxime opened this issue 5 years ago • 1 comments

Currently, the encoder API requires the user to do some manual work like apply decoder using List.map before calling Encode.list

let l = [ "a"; "b"; "c" ]

let json = 
    l
    |> List.map Encode.string
    |> Encode.list
    |> Encode.toString 4

In the decoder we do the mapping for the user Encoder API should be more similar to Decoder API.

MangelMaxime avatar Jul 23 '20 13:07 MangelMaxime

With the unify parser we don't use obj anymore but a real JSON type.

image

With this real type the compiler is now able to help the user write encoders.

MangelMaxime avatar Oct 28 '20 19:10 MangelMaxime