cappuccinotm / trn

Time Ranges
MIT License
39 stars 3 forks source link

Added json marshal/unmarshal methods and structs #5

Open krishnaduttPanchagnula opened 1 year ago

krishnaduttPanchagnula commented 1 year ago

Closes #4

krishnaduttPanchagnula commented 1 year ago

@Semior001 can you have a look at it.

Semior001 commented 1 year ago

Thank you for your contribution! However, the whole idea of such a change request was to provide the consumer a way to marshal this type as a field in their custom types and transfer it over some protocols, not just to print it to stdout. The type must be marshallable with json.Marshal and unmarshallable with json.Unmarshal, for which it should implement MarshalJSON() ([]byte, error) and UnmarshalJSON([]byte) error methods.