aeson-openapi-record-as-tuple-0.1.0.0: Encode and decode Haskell records as JSON tuples
Copyright(c) Michael Ledger 2026
LicenseMPL-2.0
MaintainerMichael Ledger <mike@quasimal.com>
Safe HaskellNone
LanguageGHC2021

Data.Aeson.RecordAsTuple

Description

 
Synopsis

Documentation

newtype RecordAsTuple a Source #

Use this with -XDerivingVia to derive aeson decoders and encoders for record types which encode the record as a JSON array rather than object.

Examples >>> data P = P {x,y,z,w::Float} deriving stock (Show,Generic) deriving (ToJSON,FromJSON) via (RecordAsTuple P) >>> JSON.toJSON (P 1 2 3 4) Array [Number 1.0,Number 2.0,Number 3.0,Number 4.0] >>> JSON.fromJSON @P (JSON.toJSON (P 1 2 3 4)) Success (P {x = 1.0, y = 2.0, z = 3.0, w = 4.0}) >>> data T = T {a,b,c::Float} deriving stock (Generic) >>> JSON.toJSON (RecordAsTuple (T 1 2 3)) Array [Number 1.0,Number 2.0,Number 3.0]

Constructors

RecordAsTuple a 

Instances

Instances details
(Generic a, Rep a ~ D1 _dt (C1 _mcons flds), GFieldsFromJSON flds) => FromJSON (RecordAsTuple a) Source # 
Instance details

Defined in Data.Aeson.RecordAsTuple

(Generic a, Rep a ~ D1 _dt (C1 _mcons flds), GFieldsToJSON flds, KnownNat (ProductSize flds)) => ToJSON (RecordAsTuple a) Source # 
Instance details

Defined in Data.Aeson.RecordAsTuple

Read a => Read (RecordAsTuple a) Source # 
Instance details

Defined in Data.Aeson.RecordAsTuple

Show a => Show (RecordAsTuple a) Source # 
Instance details

Defined in Data.Aeson.RecordAsTuple

Eq a => Eq (RecordAsTuple a) Source # 
Instance details

Defined in Data.Aeson.RecordAsTuple

Ord a => Ord (RecordAsTuple a) Source # 
Instance details

Defined in Data.Aeson.RecordAsTuple

(Generic a, Typeable a, Rep a ~ D1 _dt (C1 _mcons flds), GFieldsToSchema flds) => ToSchema (RecordAsTuple a) Source #

Gives the schema the name show (typeRep a _)@

Instance details

Defined in Data.Aeson.RecordAsTuple