Is there a way to apply modifiers inside an array in gjson?
The library tidwall/gjson allows me to parse json string and apply modifiers on it (a custom function on the value) but I dont see a way to apply a modifier on a value inside an array of structs.
How to unmarshal JSON with some known and some unknown fields in a nested structure
I have following JSON:
How to convert JSON to a generic struct in Go using interface{} without getting a map[string]interface{}?
I’m trying to convert JSON to a generic struct in Go, where the struct can have fields with varied types. To handle different types of data, I’m using the interface{} type in the struct fields. However, I don’t know the exact structure of the JSON object that will be unmarshalled, so I need a flexible solution. When I unmarshal the JSON, I end up with a map[string]interface{}, but I want to get an object (struct).
Why do I get EOF error if no body is passed but get default values if I provide “{}” in GO using json.NewDecoder(r.Body).decode?
When I make a request to the server without passing and value in the body I get and error massage as: EOF.
Unmarshal array of Json objects into struct returns blank
I’ve searched quite a bit for my specific use case but haven’t a solution, so I thought I’d ask. I’m learning Go at the moment, creating a module. But having trouble unmarshaling a json file into a struct. The contents of the json file are to be used as settings for the Asynq server since they might change and I don’t want to hardcode them.
How to apply the omitempty tag to structs when encoding JSON in Go using the encoding/json package?
Great day to everyone.
Json unmarshal – Go
Working on Json Unmarshal/marshal capabilities in Go-lang. Ran into the below exercise from Go playground link
Golang | Write JSON to spesific json category/key/field
I
golang custom request/response data fields GIN GORM
My background is python/django so in python we have serializer to decide which field should be proccessed from request body and which field should be return in response body
I can’t find something like this in golang/gin/gorm
and I see their are many people doesn’t recommend DTO (data transfer object).
so is their library or prefered pattern in go to serializer & deserialize data ?
Looping over JSON data in GO
Im trying to loop over JSON data which ive written, as a kind of json database system. Although it does write and read. I can’t seem to access the data it has readed properly