# Format Json in TableCell using JSON.stringify()

**URL:** <https://community.hubspot.com/t/format-json-in-tablecell-using-json-stringify/122666>\
**Category:** CMS Development\
**Tags:** html\
**Created:** [December 17, 2024, 4:00pm UTC](https://community.hubspot.com/t/format-json-in-tablecell-using-json-stringify/122666 "2024-12-17T16:00:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![GLopez13](https://avatars.discourse-cdn.com/v4/letter/g/d78d45/32.png) [@GLopez13](https://community.hubspot.com/u/GLopez13)\
**Post date:** [December 17, 2024, 4:00pm UTC](https://community.hubspot.com/t/format-json-in-tablecell-using-json-stringify/122666/1 "2024-12-17T16:00:14Z")

</div>

Hello,  
I would like to format the json that I am displaying in a TableCell, now I am using just JSON.stringify() and the json is displayed but in one single line making the column too long, so I would like to format it to be displayed in multiple line (like a json itself). I tried to use JSON.stringify(e.response, null, 2) but it did not work. Also tried to use HTML native tags like “pre” but seems are not supported. Any ideas?  
The code I tried was:

```lia-code-sample
<TableRow key={rowIndex}>
{headerKeyPairs.map((pair, cellIndex) => (
<TableCell key={cellIndex} width='min'>
{ onRowClick ?
(<Button onClick={() => onClickWrapper(object, rowIndex)} variant={rowIndex == selectedIndex ? 'secondary' : 'transparent'} type="button" >
{(typeof object[pair.objectKey] === 'string' ? object[pair.objectKey] : JSON.stringify(object[pair.objectKey],null,2)) || 'N/A'}
</Button>)
: (typeof object[pair.objectKey] === 'string' ? object[pair.objectKey] : JSON.stringify(object[pair.objectKey],null,2)) || 'N/A'
}
</TableCell>
))}
</TableRow><p><span> </span></p>

```

---

<div class="post-metadata">

**Author:** ![Anton](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/anton/32/103167_2.png) [@Anton](https://community.hubspot.com/u/Anton)\
**Post date:** [December 18, 2024, 9:15am UTC](https://community.hubspot.com/t/format-json-in-tablecell-using-json-stringify/122666/2 "2024-12-18T09:15:42Z")

</div>

Hey @GLopez13,

try the [fromjson](https://developers.hubspot.com/docs/reference/cms/hubl/filters#fromjson) filter to build your table.

It should be possible to import the table like this:

```lia-code-sample
{% set customJsonFile = 'URL-TO-JSON-FILE' %}

{{ customJsonFile|fromjson }}

```

best,

Anton
