Source:
<code>public Object[] getSyncConfigurationOptions(RealmConfiguration config) { if (config instanceof SyncConfiguration) { SyncConfiguration syncConfig = (SyncConfiguration) config; RealmUser user = syncConfig.getUser(); RealmApp app = user.getApp(); String rosServerUrl = syncConfig.getServerUrl().toString(); String rosUserIdentity = user.getId(); String syncRealmAuthUrl = user.getApp().getConfiguration().getBaseUrl().toString(); String syncUserRefreshToken = user.getRefreshToken(); String syncUserAccessToken = user.getAccessToken(); byte sessionStopPolicy = syncConfig.getSessionStopPolicy().getNativeValue(); String urlPrefix = syncConfig.getUrlPrefix(); String customAuthorizationHeaderName = app.getConfiguration().getAuthorizationHeaderName(); Map<String, String> customHeaders = app.getConfiguration().getCustomRequestHeaders(); BsonValue val = syncConfig.getPartitionValue(); String partitionValue = null; <START> if (val.isString()) { <END> partitionValue = "\"" + val.asString().getValue() + "\""; } else if (val.isInt32()) { partitionValue = "{ \"$bsonInt\" : " + val.asInt32().intValue() + " }"; } else if (val.isInt64()) { partitionValue = "{ \"$bsonLong\" : " + val.asInt64().longValue() + " }"; } else if (val.isObjectId()) { partitionValue = "{ \"$oid\" : " + val.asObjectId().toString() + " }"; } else { throw new IllegalArgumentException("Unsupported type: " + val); } return new Object[]{ rosUserIdentity, rosServerUrl, syncRealmAuthUrl, syncUserRefreshToken, syncUserAccessToken, syncConfig.syncClientValidateSsl(), syncConfig.getServerCertificateFilePath(), sessionStopPolicy, urlPrefix, customAuthorizationHeaderName, customHeaders, OsRealmConfig.CLIENT_RESYNC_MODE_MANUAL, partitionValue, app.getSyncService() }; } else { return new Object[15]; } }</code><technical_language>I a nice serialize json adding json keys org.bson-library</technical_language>

Target:
public Object[] getSyncConfigurationOptions(RealmConfiguration config) { if (config instanceof SyncConfiguration) { SyncConfiguration syncConfig = (SyncConfiguration) config; RealmUser user = syncConfig.getUser(); RealmApp app = user.getApp(); String rosServerUrl = syncConfig.getServerUrl().toString(); String rosUserIdentity = user.getId(); String syncRealmAuthUrl = user.getApp().getConfiguration().getBaseUrl().toString(); String syncUserRefreshToken = user.getRefreshToken(); String syncUserAccessToken = user.getAccessToken(); byte sessionStopPolicy = syncConfig.getSessionStopPolicy().getNativeValue(); String urlPrefix = syncConfig.getUrlPrefix(); String customAuthorizationHeaderName = app.getConfiguration().getAuthorizationHeaderName(); Map<String, String> customHeaders = app.getConfiguration().getCustomRequestHeaders(); BsonValue val = syncConfig.getPartitionValue(); String partitionValue = null; if (val.isString()) { partitionValue = "\"" + val.asString().getValue() + "\""; } else if (val.isInt32()) { partitionValue = "{ \"$bsonInt\" : " + val.asInt32().intValue() + " }"; } else if (val.isInt64()) { partitionValue = "{ \"$bsonLong\" : " + val.asInt64().longValue() + " }"; } else if (val.isObjectId()) { partitionValue = "{ \"$oid\" : " + val.asObjectId().toString() + " }"; } else { throw new IllegalArgumentException("Unsupported type: " + val); } Object[] configObj = new Object[SYNC_CONFIG_OPTIONS]; configObj[0] = rosUserIdentity; configObj[1] = rosServerUrl; configObj[2] = syncRealmAuthUrl; configObj[3] = syncUserRefreshToken; configObj[4] = syncUserAccessToken; configObj[5] = syncConfig.syncClientValidateSsl(); configObj[6] = syncConfig.getServerCertificateFilePath(); configObj[7] = sessionStopPolicy; configObj[8] = urlPrefix; configObj[9] = customAuthorizationHeaderName; configObj[10] = customHeaders; configObj[11] = OsRealmConfig.CLIENT_RESYNC_MODE_MANUAL; configObj[12] = partitionValue; configObj[13] = app.getSync(); return configObj; } else { return new Object[SYNC_CONFIG_OPTIONS]; } }