swift-bson icon indicating copy to clipboard operation
swift-bson copied to clipboard

SWIFT-1130 Suggestion for change to JSON dates for toRelaxedExtendedJSON()

Open NotesClef opened this issue 2 years ago • 6 comments

I would like to suggest a change to the date format resulting from toRelaxedExtendedJSON() from Date+BSONValue.swift

In the context of relaxed, users being provided JSON find it odd to see dates represented as objects (which is more mongo style than typical JSON users we supply JSON to are accustomed):

"date_valid_from": {
            "$date": "2021-12-26T00:00:00Z"
          }

For relaxed formatting, it would seem preferable to return dates instead as:

"date_valid_from": "2021-12-26T00:00:00Z"

When we wish to return JSON preserving mongo formatting, we still have canonical.

Would this suggestion be agreeable, or is there a reason I'm missing for the dates being formatted this way for relaxed?

Thank you for your consideration.

NotesClef avatar Nov 05 '21 00:11 NotesClef