0
votes

Is it possible to ignore a custom MarshalJSON implementation of a struct, and use just standard marshaling function instead?

The struct is complex, and has a lot of nested structs, all of which are using custom MarshalJSON, and I would like to ignore them all.

I feel that it should be trivial. Do you have an idea?

An obvious solution with a new type creation, does not work well, because the nested structs still use their MarshalJSONs.

"I feel that it should be trivial" - it is not. There is no option to ignore a type's explicitly-defined JSON methods. You've found the only viable solution, using a new type, but indeed it will get quite messy with nested types. If this is something you're finding you need to do, it's likely that those types shouldn't have MarshalJSON defined on them to begin with.Adrian