Specify order of output json #182
Replies: 1 comment 1 reply
-
By default, apischema orders the fields according to their position in class declaration. But there is no API specifically provided to modify order the fields. On the other hand, it can currently be done using object serialization. Could this solution fit your use case? By the way, when #181 will be released (I know, I'm very late), it will also be possible to reorder fields by using Of course, reordering fields for serialization will also affect ordering of the associated JSON schema (but you will surely agree that it's a good thing). I know these solutions are more workarounds, as they were not implemented for this purpose, and I'm open to improvements. I'm for example thinking about adding an "order" metadata like .NET's one, but aggregate fields make things complicated… |
Beta Was this translation helpful? Give feedback.
-
For a dataclass, is there a way to specify the order of the attributes when serializing the object?
Beta Was this translation helpful? Give feedback.
All reactions