src/main/java/com/hedera/hashgraph/identity/hcs/MessageEnvelope.java
/**
   * Converts a VC topic message from a JSON string into object instance.
   *
   * @param <U>          Type of the message inside envelope.
   * @param json         VC topic message as JSON string.
   * @param messageClass Class of the message inside envelope.
   * @return The {@link MessageEnvelope}.
   */
Converts a VC topic message from a JSON string into object instance.
@param           Type of the message inside envelope.
@param json         VC topic message as JSON string.
@param messageClass Class of the message inside envelope.
Converts a VC topic message from a JSON string into object instance . @param Type of the message inside envelope . @param json VC topic message as JSON string . @param messageClass Class of the message inside envelope .
public static <U extends Message> MessageEnvelope<U> fromJson(final String json, final Class<U> messageClass) {
    Gson gson = JsonUtils.getGson();
    Type envelopeType = TypeToken.getParameterized(MessageEnvelope.class, messageClass).getType();
    MessageEnvelope<U> result = gson.fromJson(json, envelopeType);
    JsonObject root = JsonParser.parseString(json).getAsJsonObject();
    result.messageJson = root.has(MESSAGE_KEY) ? root.get(MESSAGE_KEY).toString() : null;
    return result;
  }
public static < U extends Message > MessageEnvelope < U > fromJson ( final String json , final Class < U > messageClass ) { Gson gson = JsonUtils . getGson ( ) ; Type envelopeType = TypeToken . getParameterized ( MessageEnvelope . class , messageClass ) . getType ( ) ; MessageEnvelope < U > result = gson . fromJson ( json , envelopeType ) ; JsonObject root = JsonParser . parseString ( json ) . getAsJsonObject ( ) ; result . messageJson = root . has ( MESSAGE_KEY ) ? root . get ( MESSAGE_KEY ) . toString ( ) : null ; return result ; }
Converts a VC topic message from a JSON string into object instance.
Converts a VC topic message from a JSON string into object instance .
// extract original message JSON part separately to be able to verify signature.