|
|
|
|
|
by hesselink
5479 days ago
|
|
One problem I have with JSON is that there is no canonical way to represent union types. For example, if you have the Haskell type data C = A { field1 :: T1, field2 :: T2 } | B { field3 :: T3 }
How do you represent this in JSON? The contents of the 'A' or 'B' constructor are easy: { field1: value1, field2: value2 }
But how do you indicate which constructor it is? I can come up with a couple less than ideal ways. Which one do others use? |
|