thoth-org / Thoth.Json

Library for working with JSON in a type safe manner, this libs is targeting Fable

Home Page:https://thoth-org.github.io/Thoth.Json/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

MangelMaxime opened this issue · 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.

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.