final Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create();
return gson.fromJson(json, XingUser.class);
}
public static String hash(final String json, final String secretKey, final String hashAlgorithm) throws InvalidKeyException, NoSuchAlgorithmException, UnsupportedEncodingException {
final Gson gson = new Gson();
final List<String> list = new ArrayList<String>();
final Map map = gson.fromJson(json, Map.class);
join(map, list, "");
Collections.sort(list);
final String message = StringUtils.join(list, null);
final byte[] result = hmac(message, secretKey, hashAlgorithm);
return Hex.encodeHexString(result);