# Formula in kreporter

**URL:** <https://community.spicecrm.io/t/formula-in-kreporter/211>\
**Category:** KReporter\
**Created:** [November 20, 2017, 2:49pm UTC](https://community.spicecrm.io/t/formula-in-kreporter/211 "2017-11-20T14:49:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![baotrung](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@baotrung](https://community.spicecrm.io/u/baotrung)\
**Post date:** [November 20, 2017, 2:49pm UTC](https://community.spicecrm.io/t/formula-in-kreporter/211/1 "2017-11-20T14:49:48Z")

</div>

Hi,

I have json string, and i tried use json\_decode function in formula in kreporter, and seem it didn’t worked  
Is kreporter support json function in formula or not?

Thanks

---

<div class="post-metadata">

**Author:** ![maretval](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@maretval](https://community.spicecrm.io/u/maretval)\
**Post date:** [November 20, 2017, 3:21pm UTC](https://community.spicecrm.io/t/formula-in-kreporter/211/2 "2017-11-20T15:21:53Z")

</div>

It won’t. A json\_decode will return an object or an array. You need a string to display anyway, don’t you?  
Workaournd:  
Create a function in custom/include/custom\_utils.php in which you make a readable string of your json data.  
Then call the function in formula and pass the field (stored variable in manipulate) to your function.  
That shall do the trick.  
 ![AdvFormulaJsonDecode01](https://canada1.discourse-cdn.com/flex030/uploads/spicecrm/original/1X/a40f534ae3947db2dce887e1ea348c9218dd358f.png)

---

<div class="post-metadata">

**Author:** ![baotrung](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@baotrung](https://community.spicecrm.io/u/baotrung)\
**Post date:** [November 20, 2017, 5:08pm UTC](https://community.spicecrm.io/t/formula-in-kreporter/211/3 "2017-11-20T17:08:11Z")

</div>

Thanks maretval  
It worked for me  
About reason we can’t use json\_decode($jsonString) because on kreporter it use htmlentities for convert jsonString to html code, we can use directly as json\_decode(html\_entity\_decode($jsonString))  
But your suggest better for handler exception
