anchor.diff:                  serializer.Serialize(writer, values)
               | t -> // Unions
                   let uci, fields = FSharpValue.GetUnionFields(value, t)
  -                if fields.Length = 0
  -                then serializer.Serialize(writer, uci.Name)
  -                else
  +                match typeCache.TryGetValue(t) with
  +                | success, info when info.pojo ->
                       writer.WriteStartObject()
  -                    writer.WritePropertyName(uci.Name)
  -                    if fields.Length = 1
  -                    then serializer.Serialize(writer, fields.[0])
  -                    else serializer.Serialize(writer, fields)
  +                    writer.WritePropertyName("type")
  +                    writer.WriteValue(uci.Name)
  +                    Seq.zip (uci.GetFields()) fields
  +                    |> Seq.iter (fun (fi, v) ->
  +                        writer.WritePropertyName(fi.Name)
  +                        serializer.Serialize(writer, v))
                       writer.WriteEndObject()
  +                | _ ->
  +                    if fields.Length = 0
  +                    then serializer.Serialize(writer, uci.Name)
  +                    else
  +                        writer.WriteStartObject()
  +                        writer.WritePropertyName(uci.Name)
  +                        if fields.Length = 1
  +                        then serializer.Serialize(writer, fields.[0])
  +                        else serializer.Serialize(writer, fields)
  +                        writer.WriteEndObject()
       override x.ReadJson(reader, t, existingValue, serializer) =
           match t with
           | t when t.Name = "FSharpOption`1" ->
  
positive.code: namespace Fable
  
  #if DOTNETCORE
  [<AutoOpen>]
  
negative.code:                     FSharpValue.MakeUnion(uci, [|value|])
              | JsonToken.Null -> null // for { "union": null }
              | _ -> failwith "invalid token"
  
  #if INTERACTIVE
  #r "../../../build/fable-core/Fable.Core.dll"
  
  [<Fable.Core.Pojo>]
  type U =
      | MyCase of ja:int * jo:string
  
  module Test =
      JsonConvert.SerializeObject(MyCase(5,"4"), JsonConverter())
      |> printfn "%s"
  #endif
  