If you just happen to have fields that may not be specified, you can unmarshal your input into a struct with pointer. If the field isn't present, the pointer will be nil.
package main
import (
"encoding/json"
"fmt"
)
type Foo struct {
A *string
B *string
C *int
}
func main() {
var input string = `{"A": "a","C": 3}`
var foo Foo
json.Unmarshal([]byte(input), &foo)
fmt.Printf("%#v\n", foo)
}
Playground
If you really want something more flexible, you can also unmarshal your input into a map[string]interface{}.
package main
import (
"encoding/json"
"fmt"
)
func main() {
var input string = `{"A": "a","C": 3}`
var foo map[string]interface{} = make(map[string]interface{})
json.Unmarshal([]byte(input), &foo)
fmt.Printf("%#v\n", foo)
}
Playground