JsonDeserializationContext context) throws JsonParseException {
JsonObject jsonObject = json.getAsJsonObject();
String id = jsonObject.get(ResponseProperty.ID.key()).getAsString();
if (jsonObject.has(ResponseProperty.ERROR.key())) {
JsonElement errorObject = jsonObject.get(ResponseProperty.ERROR.key());
String errorMessage = errorObject.getAsJsonObject().get("message").getAsString();
return JsonRpcResponse.error(id, errorMessage);
}
// Deserialize the data.
Map<ParamsProperty, Object> properties = new HashMap<ParamsProperty, Object>();
JsonElement data = jsonObject.get(ResponseProperty.DATA.key());
if (data != null && data.isJsonObject()) {
for (Entry<String, JsonElement> parameter : data.getAsJsonObject().entrySet()) {
ParamsProperty parameterType = ParamsProperty.fromKey(parameter.getKey());
if (parameterType == null) {
// Skip this unknown parameter.
continue;
}