Open jpeg729 opened 2 years ago
One could even add an escape hatch override, that just asks JsonSerializer to take over, but I am not sure you will want to go in that direction
[<CustomOperation("prop")>]
member inline _.Prop([<InlineIfLambda>] previous: Render, name:string, value:obj) =
Render(fun writer ->
previous.Invoke(writer)
JsonSerializer.Serialize(writer, value)
)
A small inconsistency...
The example for parsing uses Parse.xxx uniformly and doesn't need the user to
open FSharp.Explicit.Json.Parse
. The example for rendering usesobject
directly so you would need toopen FSharp.Explicit.Json.Render
, but if you do that then you hide the usualint
,long
and so on.Given that you are targetting net6.0 you could use overrides of custom operations on the CE. Something like this would work...
Then you can do this
The CE code is longer, but the API is a little nicer.