You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our application panics when trying to marshal a struct using the github.com/goccy/go-json package. The issue seems to occur when attempting to serialize a struct.
Steps to Reproduce:
Create a new Go file with the following code:
package main
import (
"fmt"
"github.com/goccy/go-json"
)
type Body struct {
Payload *Detail `json:"p,omitempty"`
}
type Detail struct {
I Item `json:"i"`
}
type Item struct {
A string `json:"a"`
B string `json:"b,omitempty"`
}
func main() {
b, err := json.Marshal(Body{
Payload: &Detail{
I: Item{
A: "a",
B: "b",
},
},
})
fmt.Println(err)
fmt.Println(string(b))
}
Run the program using the go run command.
Expected Result:
The program should output the JSON string without any errors, similar to: {"p":{"i":{"a":"a","b":"b"}}}
Actual Result:
The program panics and does not output the expected JSON string.
Additional Information:
go.mod
module my.com/app
go 1.22.5
require github.com/goccy/go-json v0.10.3
Our application panics when trying to marshal a struct using the github.com/goccy/go-json package. The issue seems to occur when attempting to serialize a struct.
Steps to Reproduce:
Create a new Go file with the following code:
Run the program using the
go run
command.Expected Result:
The program should output the JSON string without any errors, similar to:
{"p":{"i":{"a":"a","b":"b"}}}
Actual Result:
The program panics and does not output the expected JSON string.
Additional Information:
go.mod
The text was updated successfully, but these errors were encountered: