0

How to add few custom data fields for new QBUser? I know how to make it for single custom data field.

public static String customDataToString(String key,String value) {
    JSONObject jsonObject = new JSONObject();

    setJsonValue(jsonObject, key,value);


    return jsonObject.toString();
}

private static void setJsonValue(JSONObject jsonObject, String key, String value) {
    if (!TextUtils.isEmpty(value)) {
        try {
            jsonObject.put(key, value);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
}

Should I use jsonarray or something to make it work with multiple fields?

Anton Kazakov
  • 2,740
  • 3
  • 23
  • 34

1 Answers1

0

The user's custom data is just a string and you can put any values right here.

To put many fields you can user JSON for example.

Rubycon
  • 18,156
  • 10
  • 49
  • 70