# Insert JSON String into Power Table

**URL:** <https://forum.inductiveautomation.com/t/insert-json-string-into-power-table/73083>\
**Category:** General Discussion\
**Tags:** vision\
**Created:** [May 1, 2023, 1:12pm UTC](https://forum.inductiveautomation.com/t/insert-json-string-into-power-table/73083 "2023-05-01T13:12:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![brianherzfeldt](https://avatars.discourse-cdn.com/v4/letter/b/5daacb/32.png) [@brianherzfeldt](https://forum.inductiveautomation.com/u/brianherzfeldt)\
**Post date:** [May 1, 2023, 1:12pm UTC](https://forum.inductiveautomation.com/t/insert-json-string-into-power-table/73083/1 "2023-05-01T13:12:32Z")

</div>

I have a JSON string stored in a database column. I would like to display this information in a power table on a vision screen. I am looking for a good way to do this. Any thoughts?

[{"PartNumber": "212C1031P102", "FullOrder": "15220593", "Index": 0, "tableID": 151}, {"PartNumber": "212C1031P102", "FullOrder": "15220593", "Index": 1, "tableID": 151}]

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 1, 2023, 1:23pm UTC](https://forum.inductiveautomation.com/t/insert-json-string-into-power-table/73083/2 "2023-05-01T13:23:19Z")

</div>

Hmm. You can use the `configureCell` extension method to return a java Swing component to render the cell. You could construct a JPanel with MigLayout and a collection of labels with that content. You'll have to play with row and column width settings to make it look nice, I suspect.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [May 1, 2023, 2:57pm UTC](https://forum.inductiveautomation.com/t/insert-json-string-into-power-table/73083/3 "2023-05-01T14:57:04Z")

</div>

You're wanting to import the database columns that contain data like your sample with the keys as the header names and the values as the data in the table?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 1, 2023, 3:13pm UTC](https://forum.inductiveautomation.com/t/insert-json-string-into-power-table/73083/4 "2023-05-01T15:13:17Z")

</div>

> [@pturmel](#):
>
> You can use the `configureCell` extension method to return a java Swing component to render the cell.

A sufficiently enterprising person could construct a `com.inductiveautomation.ignition.client.jsonedit.JsonEditor` at runtime, for a nice JSON editing/viewing experience. That'd make for a fun Vision component, too... 🤔

I suspect the actual task here is closer to what @justinedwards.jle is describing, though, so the JSON is basically immaterial; it's just a flat array of key:value pairs. I would just normalize the JSON to a proper Ignition dataset via scripting. Then you use the table as normal.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 1, 2023, 3:40pm UTC](https://forum.inductiveautomation.com/t/insert-json-string-into-power-table/73083/5 "2023-05-01T15:40:33Z")

</div>

> [@paul-griffith](#):
>
> sufficiently enterprising person

/me dodges the nerd snipe....

---

<div class="post-metadata">

**Author:** ![brianherzfeldt](https://avatars.discourse-cdn.com/v4/letter/b/5daacb/32.png) [@brianherzfeldt](https://forum.inductiveautomation.com/u/brianherzfeldt)\
**Post date:** [May 15, 2023, 4:01pm UTC](https://forum.inductiveautomation.com/t/insert-json-string-into-power-table/73083/6 "2023-05-15T16:01:41Z")

</div>

I was able to parse the JSON string out with a simple SQL query in the bindings.

DECLARE @JsonMsg nvarchar(max)

Select @JsonMsg = [PartsList]

FROM [ABB\_Housing].[dbo].[RawStockRecordTable]  
WHERE [TrackingNum] = {Root Container.TrackingNum}

SELECT \* FROM OpenJson(@JsonMsg)  
WITH ( [Index] int,  
[PartNumber] VARCHAR(100),  
[FullOrder] VARCHAR(100),  
[tableID] bigint )  
ORDER BY [Index]
