aeson
                                
                                
                                
                                    aeson copied to clipboard
                            
                            
                            
                        Add a SumEncoding option that's somewhere between a TaggedObject and an UntaggedValue
Sometimes the tag and the content of the JSON you're processing are on the same level where both TaggedObject and UntaggedValue will not suffice. I propose adding another SumEncoding option that handles this case. The implementation should be very similar to that of UntaggedValue.
Hmmm, this is tricky to implement for constructors that do not have field names. We cannot drop them cause then we will lose the roundtrip property. Maybe we should use the position as the key when encoding and decoding. For example, A 1 1 should be encoded to
{
  "tag": "A",
  "1" : 1,
  "2": 1
}
where A is defined as
data A = A Int Int | B Int Int