Synchronizing a field of a JSON attribute into a non-JSON attribute
If the source stores:
ubidEmailJSON: {"value" : "jsmith@example.com", "type" : "home"}
But the destination stores:
mail: jsmith@example.com
To synchronize changes between these systems, configure a constructed attribute mapping:
$ bin/dsconfig create-attribute-mapping \
--map-name "Attribute Map" \
--mapping-name mail \
--type constructed \
--set "value-pattern:{contact.ubidEmailJSON.value}"
-
The
value-patternsyntax allows attributes to be referenced by placing them in{}. -
To reference JSON fields within the attribute, use the syntax
{attribute.field}.
Learn more in the configuration documentation included with the server or by running bin/dsconfig --help-sync.
|
The value-pattern:{contact.ubidEmailJSON.value}
When a {"a": [{"b": "b value 1"}, {"b": "b value 1"}]}
Then applying the pattern b value 1 b value 1 When it’s unclear whether a dot is a character in the JSON field name or a separator between JSON field names, the parser favors a literal dot in the field name over the dot being a path separator. |
After you create the attribute map, you can reference it from the sync class:
$ bin/dsconfig set-sync-class-prop \
--pipe-name "A to B" \
--class-name Users \
--set "attribute-map:Attribute Map"
Troubleshooting
While LDAP attribute names are not case sensitive, the JSON field names are. By default, errors related to attribute mapping are not logged. To enable error logging, configure the Debug Logger with the following:
$ bin/dsconfig set-log-publisher-prop \
--publisher-name "File-Based Debug Logger" \
--set enabled:true
$ bin/dsconfig create-debug-target \
--publisher-name "File-Based Debug Logger" \
--target-name com.unboundid.directory.sync.mapping \
--set debug-level:warning