# Json import using data visualizer , json array shows values comma seperates

**URL:** <https://discuss.elastic.co/t/json-import-using-data-visualizer-json-array-shows-values-comma-seperates/279531>\
**Category:** Kibana\
**Tags:** elastic-stack-machine-learning\
**Created:** [July 24, 2021, 12:54pm UTC](https://discuss.elastic.co/t/json-import-using-data-visualizer-json-array-shows-values-comma-seperates/279531 "2021-07-24T12:54:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anjana1](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@anjana1](https://discuss.elastic.co/u/anjana1)\
**Post date:** [July 24, 2021, 12:54pm UTC](https://discuss.elastic.co/t/json-import-using-data-visualizer-json-array-shows-values-comma-seperates/279531/1 "2021-07-24T12:54:31Z")

</div>

Kibana version : 7.13

Elasticsearch version : 7.13

APM Server version : 7.13

APM Agent language and version : java 1.8

Fresh install or upgraded from other version? fresh install

Is there anything special in your setup? For example, are you using the Logstash or Kafka outputs? Are you using a load balancer in front of the APM Servers? Have you changed index pattern, generated custom templates, changed agent configuration etc. :-no

I have imported a json data file using data visualizer. I have few fields with json array in it. SO after I import the data in discover the data within the array is shown as comma seperated values.

My data is displayed as

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/a/aa5508c492281a8d2112bb8175c39415a059bf87.png)

I am expecting it to be shown in discover as

```auto
BrandName:{
"Brand":"Optical"
},
{
"Brand":"Sun"
}

```

But instead it just displays as comma separated. Because of which when I apply a filter on dashboards to filter based on "Sun" brand it just filters based on both the "optical" and "sun" as same field has both the values.

Here is my mapping for that field

```auto
       "BrandName": {
          "properties": {
            "brand": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            }
          }
        },

```

How can I get the data in the index displayed as two different elements within a json array , instead of comma seperated values

In my ndjson the data is passed as below

"BrandName":[{"brand":"Optical"},{"brand":"Sun"}]

---

<div class="post-metadata">

**Author:** ![anjana1](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@anjana1](https://discuss.elastic.co/u/anjana1)\
**Post date:** [July 26, 2021, 4:55am UTC](https://discuss.elastic.co/t/json-import-using-data-visualizer-json-array-shows-values-comma-seperates/279531/2 "2021-07-26T04:55:21Z")

</div>

Hi

Any updates on this

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [August 3, 2021, 6:16pm UTC](https://discuss.elastic.co/t/json-import-using-data-visualizer-json-array-shows-values-comma-seperates/279531/3 "2021-08-03T18:16:31Z")

</div>

Hello, having them as an array won't be a good solution since array functionality is not good in Kibana as you won't be able to aggregate on that field.  
How I would recommend is to use the brand directly as "optical sun" and set it as text and not keyword. This way any search on "optical" or "sun" would find that item, since the field will be analyzed.

---

<div class="post-metadata">

**Author:** ![anjana1](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@anjana1](https://discuss.elastic.co/u/anjana1)\
**Post date:** [August 4, 2021, 8:19am UTC](https://discuss.elastic.co/t/json-import-using-data-visualizer-json-array-shows-values-comma-seperates/279531/4 "2021-08-04T08:19:30Z")

</div>

Thanks @Marius_Dragomir

But in my Import NDJSON file , how will I pass different values for Brand

This is one sample record as below. So for one single record I have multiple values for brand. How can i pass both "sun" and "optical" as text in the same record without an array

{"Fiscal Week":"FW01","StartTime":"Dec 31 2019 00:00:00","EndTime":"Jan 1 2020 01:00:00","month":"Jan","Year":"2020","Summary":"Store power failure","Description":"Natural phenomena such as wind, lightning, freezing rain","AppName":"xxx",**"BrandName":[{"brand":"Optical"},{"brand":"Sun"}]**  
,"Orgs":[{"Org":"0"},{"Org":"20"}],"Banners":[{"Banner":"zzz"},{"Banner":"yyy"}],"Regions":[{"Region":"USA"},{"Region":"CAN"}],"Total Stores":"10","Store Count":"2","Severity":"98","Outage Hours":25,"App Uptime in %":50,"Actual Store SLA %":100,"Actual Severity SLA %":98 ,"SLA Store Comp":100,"SLA Comp Severity":100}

As per what you said pass the brand as "brand":"Optical Sun" in the ND JSON file?

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [August 4, 2021, 10:00am UTC](https://discuss.elastic.co/t/json-import-using-data-visualizer-json-array-shows-values-comma-seperates/279531/5 "2021-08-04T10:00:15Z")

</div>

yes, that would work. The data visualizer isn't really the intended way to ingest a lot of data, it's there for a small number of records to see how things work.  
Normally you'd go through elasticsearch pipelines or Logstash and you could merge/flatten that array that you have at ingest in the pipelines.  
If you insist on using the data visualizer you have to do the merge yourself before importing the data in the Data Visualizer.

---

<div class="post-metadata">

**Author:** ![anjana1](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@anjana1](https://discuss.elastic.co/u/anjana1)\
**Post date:** [August 4, 2021, 12:23pm UTC](https://discuss.elastic.co/t/json-import-using-data-visualizer-json-array-shows-values-comma-seperates/279531/6 "2021-08-04T12:23:19Z")

</div>

Thanks @Marius_Dragomir is there an example where I can see this merge if flatten the Json . I see there is a pipeline option in the advance setting in data visualiser . How can I flatten the Json for this intended purpose ? I tried to use option sun in the brand section but it goes as a single text with both the values and is considering as a single value not two different values

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 1, 2021, 12:23pm UTC](https://discuss.elastic.co/t/json-import-using-data-visualizer-json-array-shows-values-comma-seperates/279531/7 "2021-09-01T12:23:21Z")

</div>

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