putAll
Imports all tags from a JSON object, adding them to the builder.
This method extracts all key-value pairs from the provided JSON object and adds them as tags. This is useful for bulk importing tags from API responses, local storage, or configuration files. Existing tags with the same keys will be overwritten.
Example (Importing from API Response):
// Received user profile from backend API
JSONObject userProfile = apiResponse.getJSONObject("profile");
// {
// "name": "Jane Smith",
// "age": 32,
// "premium": true,
// "interests": ["music", "travel", "photography"]
// }
TagsBundle tags = new TagsBundle.Builder()
.putAll(userProfile) // Import all fields from JSON
.putString("sync_source", "api") // Add additional tags
.putLong("last_sync", System.currentTimeMillis())
.build();
Pushwoosh.getInstance().sendTags(tags);
Content copied to clipboard
Note: All JSON value types (strings, numbers, booleans, arrays, nested objects) are supported and automatically converted to appropriate tag types.
Return
this Builder instance for method chaining
Parameters
json
JSON object containing tag name-value pairs to import