This answer explains well why you get the exception.
What you should do:
When the encoding/json package runs into a type that implements the Marshaler interface, it uses that type’s
MarshalJSON() method instead of the default marshaling code to turn the object into JSON. Similarly, when decoding a JSON object it will test to see if the object implements the Unmarshaler interface, and if so it will use the
UnmarshalJSON() method instead of the default unmarshaling behavior.
Mine solution for this would be to implement UnmarshalJSON method on
*ConfigurationData and method
Load should accept Unmarshaler interface instead of
You can read more about technics here: https://blog.gopheracademy.com/advent-2016/advanced-encoding-decoding/
Then you simple would do
json.Unmarshal(b, &config) inside the
Load method where b is
byte read from file.