The signature for the JSON encode method is shown below:
public void Encode(Asn1JsonOutputStream buffer )
The buffer argument is an Asn1JsonOutputStream object which receives the encoded message. This must be created and initialized before calling any encode method. See the description of this class in the C# Run-Time Classes section for details on how this class is used. Since JSON is a character-based encoding, Asn1JsonOutputStream are constructed on System.IO.TextWriter instances. There is a subclass, Asn1JsonOutputBuffer, that can be used to output to a byte array.
As you can see, the encode methods return void; an exception is thrown if an error occurs. All ASN1C C# exceptions are derived from Asn1Exception. See the section on exceptions for a complete list and description of the various exceptions that can be thrown.