code: private HashMap<String, String> getMapFromJson(String customJson) {
          HashMap<String, String> command = new HashMap<>();
          if (customJson != null) {
              try {
                  JSONObject jsonObject = new JSONObject(customJson);
                  Iterator iterator = jsonObject.keys();
                  while (iterator.hasNext()) {
                      String key = (String) iterator.next();
                      String value = jsonObject.getString(key);
                      command.put(key, value);
                  }
                  return command;
              } catch (JSONException exception) {
                  return null;
              }
          } else
              return null;
      }
docs: **
  This method will return a map of the key value pairs received from JSON.
  If JSON is invalid it will return null.
  @param customJson
  @return HashMap