# JSON input syntax

**URL:** <https://discuss.elastic.co/t/json-input-syntax/167487>\
**Category:** Kibana\
**Created:** [February 7, 2019, 4:32pm UTC](https://discuss.elastic.co/t/json-input-syntax/167487 "2019-02-07T16:32:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alimo77](https://avatars.discourse-cdn.com/v4/letter/a/cdc98d/32.png) [@alimo77](https://discuss.elastic.co/u/alimo77)\
**Post date:** [February 7, 2019, 4:32pm UTC](https://discuss.elastic.co/t/json-input-syntax/167487/1 "2019-02-07T16:32:57Z")

</div>

I am creating a data table visualization and I have a value that is either a 1 or 0, but in the column I was hoping to use json input so that if the value is a 1 it displays up and 0 displays down in the data table. Is that possible?

This is not working:  
{  
"script": "if (doc['status-check'].value = 0) {return down} else {return up}"  
}

---

<div class="post-metadata">

**Author:** ![cjcenizal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cjcenizal/32/11216_2.png) [@cjcenizal](https://discuss.elastic.co/u/cjcenizal)\
**Post date:** [February 8, 2019, 7:29pm UTC](https://discuss.elastic.co/t/json-input-syntax/167487/2 "2019-02-08T19:29:29Z")

</div>

Hi Alison, you should be able to create a [scripted field](https://www.elastic.co/guide/en/kibana/current/scripted-fields.html) in your index pattern which can map the value to a string. It will be something like this:

```auto
if (doc['status-check'].value == 0) {
  return "down";
}
return "up";

```

Hope this helps,  
CJ

---

<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:** [March 8, 2019, 7:29pm UTC](https://discuss.elastic.co/t/json-input-syntax/167487/3 "2019-03-08T19:29:33Z")

</div>

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