# List\<String\> property in JSON config in REST

**URL:** <https://forum.confluent.io/t/list-string-property-in-json-config-in-rest/1273>\
**Category:** Kafka Connect\
**Created:** [23 March 2021 15:39 UTC](https://forum.confluent.io/t/list-string-property-in-json-config-in-rest/1273 "2021-03-23T15:39:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sirius\_Dour](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/sirius_dour/32/454_2.png) [@Sirius\_Dour](https://forum.confluent.io/u/Sirius_Dour)\
**Post date:** [23 March 2021 15:39 UTC](https://forum.confluent.io/t/list-string-property-in-json-config-in-rest/1273/1 "2021-03-23T15:39:07Z")

</div>

Hi

could you help me with next question:  
i am trying to add new connector using REST API

i am using _MyConnector_ extends _AbstractSpoolDirSourceConnector_  
and _MyConnectorConfig_ extends _AbstractSpoolDirSourceConnectorConfig_

as i understand all properties from “config” field of JSON should be moved into _private final Map\<String, Object\> values_ field under my _MyConnectorConfig_  
and there is _public List getList(String key)_ method available

i tried to add list property in my json config but in this case REST API returns error:

> “Cannot deserialize instance of `java.lang.String` out of START\_ARRAY token\n at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 1400] (through reference chain: org.apache.kafka.connect.runtime.rest.entities.CreateConnectorRequest["config"]-\>java.util.LinkedHashMap["myProperty"])”

my question is: why in one hand (in _AbstractConfig_) we have _Map\<String, **Object** \> values_  
and in other hand (in _CreateConnectorRequest_) we have _Map\<String, **String** \> config_ that prevents us to use anything but String as values  
is it possible to pass List through it or I have to do additional conversion in/from String?

P.S. for number and boolean it is working fine: REST is not returning error and values can be taken from config using getInt() and getBoolean() methods

---

<div class="post-metadata">

**Author:** ![Sirius\_Dour](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/sirius_dour/32/454_2.png) [@Sirius\_Dour](https://forum.confluent.io/u/Sirius_Dour)\
**Post date:** [24 March 2021 09:51 UTC](https://forum.confluent.io/t/list-string-property-in-json-config-in-rest/1273/2 "2021-03-24T09:51:36Z")

</div>

looks like List should be defined in JSON in next format

> “myProperty”: “value-1, value-2”

in this case I can use _myConnectorConfig.getList(“myProperty”)_ and get it as _java.util.Arrays$ArrayList_

> [value-1, value-2]

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/confluentcommunity/original/1X/c49438c90c9df282e9996fdf6971be890c71b65a.svg) [@system](https://forum.confluent.io/u/system)\
**Post date:** [31 March 2021 09:52 UTC](https://forum.confluent.io/t/list-string-property-in-json-config-in-rest/1273/3 "2021-03-31T09:52:29Z")

</div>

Closed on 31 March 2021 09:52 UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
