feat: add option for additional default in json serializer
This addresses the change in orjson that no longer serializes NamedTuples by default to dictionaries. This is potentially the correct behavior, so the approach taken was to give an option for additional defaults in the serializer (which already does some work for numpy).
A related PR in databroker takes advantage of this.
Checklist
- [x] Add a Changelog entry
- [x] Add the ticket number which this PR closes to the comment section (None present)
@ambarb for visibility
As discussed in the companion PR to databroker @maffettone and I agree the best option is to fix this in the device, to use a serializable type.
@maffettone does this mean we need to put in something to hklpy (or pyhkl, whichever is the correct one)?
~Yes, I thought I put an issue there, but on double checking it was a different issue. I'll add something this morning.~
EDIT
It looks like hklpy handles its named tuples into arrays when it reads them, so no change is needed there. When you grab it as an attribute (sample.lattice) for putting into RE.md, if you hit an error casting it as a dictionary, we can address that at the profile level.