xyncro / chiron

JSON for F#
https://xyncro.tech/chiron
MIT License
175 stars 41 forks source link

No serialisation for byte [] #25

Open haf opened 9 years ago

haf commented 9 years ago

Trying to add


        static member inline FromJson (_ : byte []) : Json<byte []> =
                fun x ->
                    try
                        Json.init (Convert.FromBase64String x)
                    with e ->
                        Json.error "bad base64 string"
            =<< Json.getLensPartial (stringPLens ())

Gives

screen shot 2015-04-21 at 11 29 10

kolektiv commented 9 years ago

Hmm, interesting, I'll have a look at that.

haf commented 9 years ago

Ping?

kolektiv commented 9 years ago

Will work on this in the week and have a resolution for 5.0 one way or another!

kolektiv commented 9 years ago

Sorry it's been rather busier than I've imagined on this. Now I'm looking at this properly, I'm not totally sure what you're aiming for. Deserializing an array of strings... I'm not sure how inference should know that byte arrays are involved? And how are they? :)

haf commented 9 years ago

If I add an overload for serialising byte arrays, then I can't serialise strings.

haf commented 9 years ago

Or let's say this: I want a nice way of serialising byte arrays :).

kolektiv commented 9 years ago

That makes sense :) I'll have a think about that - there must be a reasonable answer!