Simplifying JSON Conversion with jsonconv: A Go Package for Efficient Data Handling

Introduction In the world of Go development, efficiently handling data exchange between applications and services is crucial. JSON, a ubiquitous data format, plays a vital role in this process. However, manually converting Go values to and from JSON can be cumbersome and error-prone. This is where the jsonconv package comes in, offering a streamlined and robust solution for JSON conversion. Benefits of Using jsonconv The jsonconv package provides several key benefits that enhance your Go development experience:...

May 24, 2024 · 3 min · 601 words · Mecit Semerci

Golang json (Un)marshal custom date format

If we want to create a RESTFul API, we may need a date type field. Especially you are doing an integration API, the date format may not always be what you want. JSON serialization on GO can be annoying sometimes. In such cases, you can follow a method like that. go version 1.16 package customTypes import ( "errors" "fmt" "strings" "time" ) type JSONTime time.Time const DefaultFormat = time.RFC3339 var layouts = []string{ DefaultFormat, "2006-01-02T15:04Z", // ISO 8601 UTC "2006-01-02T15:04:05Z", // ISO 8601 UTC "2006-01-02T15:04:05....

August 24, 2020 · 2 min · 401 words · Mecit Semerci