Encoding to JSON is similar to other encoding rules. For each ASN.1 production defined in an ASN.1 source file, an encode method may be generated. This function will convert a populated variable of the given type into an encoded ASN.1 message.
An encode method is only generated if it is required to alter the behavior of the base class. The C# model is built on inheritance from a set of common run-time base classes. These run-time classes contain default implementations of encode/decode methods that handle the encoding/decoding of the basic types. The generated classes for all constructed types (SEQUENCE, SEQUENCE OF, and CHOICE) will include generated encode methods.