code: public final Object encode(Object value) {
        if (value == null) {
           return null;
        }
        if (value instanceof Val) {
           return encodeImpl(Cast.<Val>as(value).get());
        }
        return encodeImpl(value);
     }
docs: Encodes a value into a Json writeable type (String or Number).
  
  @param value the value
  @return the encoded value