examples/appnet-api-server/src/main/java/com/hedera/hashgraph/identity/hcs/example/appnet/vc/Ed25519CredentialProof.java
/**
   * Note: this is a manual implementation of ordered JSON items.
   * In a real-world application it is recommended to use a JSON-LD compatible library to handle normalization.
   * However at this point the only available one in Java support JSON-LD version 1.0, but 1.1 is required by W3C
   * Verifiable Credentials.
   *
   * @param withoutSignature Will skip signature value ('jwk' attribute) if True.
   * @return A normalized JSON string representation of this proof.
   */
this is a manual implementation of ordered JSON items.
In a real-world application it is recommended to use a JSON-LD compatible library to handle normalization.
However at this point the only available one in Java support JSON-LD version 1.0, but 1.1 is required by W3C
Verifiable Credentials.

@param withoutSignature Will skip signature value ('jwk' attribute) if True.
@return A normalized JSON string representation of this proof.
this is a manual implementation of ordered JSON items . In a real - world application it is recommended to use a JSON - LD compatible library to handle normalization . However at this point the only available one in Java support JSON - LD version 1 . 0 but 1 . 1 is required by W3C Verifiable Credentials . @param withoutSignature Will skip signature value ( ' jwk ' attribute ) if True . @return A normalized JSON string representation of this proof .
public JsonElement toNormalizedJsonElement(final boolean withoutSignature) {
    Gson gson = JsonUtils.getGson();
    JsonObject root = gson.toJsonTree(this).getAsJsonObject();
    LinkedHashMap<String, JsonElement> map = new LinkedHashMap<>();
    for (String property : JSON_PROPERTIES_ORDER) {
      if (JSON_PROPERTY_JWS.equals(property) && withoutSignature) {
        continue;
      } else if (root.has(property)) {
        map.put(property, root.get(property));
      }
    }
    return gson.toJsonTree(map);
  }
public JsonElement toNormalizedJsonElement ( final boolean withoutSignature ) { Gson gson = JsonUtils . getGson ( ) ; JsonObject root = gson . toJsonTree ( this ) . getAsJsonObject ( ) ; LinkedHashMap < String , JsonElement > map = new LinkedHashMap < > ( ) ; for ( String property : JSON_PROPERTIES_ORDER ) { if ( JSON_PROPERTY_JWS . equals ( property ) && withoutSignature ) { continue ; } else if ( root . has ( property ) ) { map . put ( property , root . get ( property ) ) ; } } return gson . toJsonTree ( map ) ; }
Note: this is a manual implementation of ordered JSON items.
Note : this is a manual implementation of ordered JSON items .
// First turn to normal JSON // Then put JSON properties in ordered map // Turn map to JSON