# Populating a Pie-Chart from a JSON Object / Dictionary?

**URL:** https://discuss.elastic.co/t/populating-a-pie-chart-from-a-json-object-dictionary/165031
**Category:** Kibana
**Created:** [January 21, 2019, 10:31am UTC](https://discuss.elastic.co/t/populating-a-pie-chart-from-a-json-object-dictionary/165031 "2019-01-21T10:31:28Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mmisztal1980](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mmisztal1980/32/38519_2.png) [@mmisztal1980](https://discuss.elastic.co/u/mmisztal1980)
#### Post date: [January 21, 2019, 10:31am UTC](https://discuss.elastic.co/t/populating-a-pie-chart-from-a-json-object-dictionary/165031/1 "2019-01-21T10:31:28Z")

</div>

Hey all,

My structured logging framworks indexes the documents with the following structure fragment:

```json
{
    "ZoneId": "abc",
    "Results": {
        "a": 5,
        "b": 14,
        "c": 22
    }
}

```

```json
{
    "ZoneId": "def",
    "Results": {
        "a": 5,
        "g": 14,
        "h": 22
    }
}

```

I'm looking to create a pie-chart visualization that would be capable of displaying the `Results` node (values = pie chart arcs and keys as labels)

Is this achievable? How should one approach it?  
From the above input I'd expect to have a pie chart with 5 segments (a,b ,c ,g, h) with apropriate value aggregations.  
Please note that if the above input structure won't work, I'm open to modifying it

---

<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: [January 21, 2019, 3:16pm UTC](https://discuss.elastic.co/t/populating-a-pie-chart-from-a-json-object-dictionary/165031/2 "2019-01-21T15:16:58Z")

</div>

I don't see a way to do it with the current structure, easiest way to do it would be to have separate documents for each keys, something like this for the first document (it would be split in 3 documents):

```auto
{
    "ZoneId": "abc",
    "Results_key": "a",
   "Results_value": 5
}
{
    "ZoneId": "abc",
    "Results_key": "b",
   "Results_value": 14
}
{
    "ZoneId": "abc",
    "Results_key": "c",
   "Results_value": 22
}

```

Then you could do a Pie Chart with Split by Terms on `Results_key` field and Using Average or whatever metric you need on the field `Results_value`.

---

<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: [February 18, 2019, 3:17pm UTC](https://discuss.elastic.co/t/populating-a-pie-chart-from-a-json-object-dictionary/165031/3 "2019-02-18T15:17:09Z")

</div>

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