# Storing Objects in Tables and Extracting from JSON Strings

**URL:** <https://community.tulip.co/t/storing-objects-in-tables-and-extracting-from-json-strings/10106>\
**Category:** Show and Tell\
**Created:** [December 20, 2023, 4:47pm UTC](https://community.tulip.co/t/storing-objects-in-tables-and-extracting-from-json-strings/10106 "2023-12-20T16:47:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielpomeranz](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tulip.co/danielpomeranz/32/9379_2.png) [@danielpomeranz](https://community.tulip.co/u/danielpomeranz)\
**Post date:** [December 20, 2023, 4:47pm UTC](https://community.tulip.co/t/storing-objects-in-tables-and-extracting-from-json-strings/10106/1 "2023-12-20T16:47:59Z")

</div>

This topic has come up in the past and I think I just came across a pretty good solution!

When working in Tulip apps, you may generate variables of an object list which allows you to have an undefined number of records of a defined structure. Something like this would store a list of material traceability records which could be captured on a step where you might need more than one.

![image](https://us1.discourse-cdn.com/flex020/uploads/agilemfg/original/2X/4/445f47ce63da51d2077029011505230b1807ff05.png)

This specific example could be resolved by writing multiple table records instead of generating the list variable, but there are times where this isn’t possible (for example, when working with connector outputs). If necessary, one can then store this entire data chunk in a text field in Tulip like so:

![image](https://us1.discourse-cdn.com/flex020/uploads/agilemfg/original/2X/3/3aa3ee7910562deb63107305458619dabf367b5a.png)

The text will be stored as a JSON representation of the object:

```auto
[
   {
      "id":"p6tAQmeTGXvPnLipi",
      "work order":"WO1234",
      "component lot":"L740201",
      "quantity":1,
      "operator id":"0000",
      "timestamp":1701963638
   },
   {
      "id":"dBWJFtkaSBKdPuZhP",
      "work order":"WO1234",
      "component lot":"L734520",
      "quantity":1,
      "operator id":"0000",
      "timestamp":1701963638
   },
   {
      "id":"ZejucDtYZdvvEc7qC",
      "work order":"WO1234",
      "component lot":"L723111",
      "quantity":1,
      "operator id":"0000",
      "timestamp":1701963638
   },
   {
      "id":"zNyrwetPQNWk2CMT6",
      "work order":"WO1234",
      "component lot":"L723111",
      "quantity":1,
      "operator id":"0000",
      "timestamp":1701963638
   }
]

```

But the problem is that Tulip had no good way to unpack this JSON. Until now! I was messing around and realized that you can utilize a dummy postgresql connector (which most instances have by default) to create a function for extracting this data. The connector takes in a string of text as an input, and utilizes native postgres functionality to transform it into a Tulip object format. I am sure other SQL dialects can do this too. With a connector function like below we can now work with JSON objects in Tulip. This also opens up a ton of possibilities for parsing JSON from external applications. Hopefully someone finds this useful!

 ![image](https://us1.discourse-cdn.com/flex020/uploads/agilemfg/original/2X/c/cbb44e08eadcbe09f8a611e33fe41fdffb18390f.png)

```auto
-- SQL Snippet
-- For more info go here: postgresql.org/docs/9.3/functions-json.html
select
json_list->'id' as id,
json_list->'work order' as work_order,
json_list->'component lot' as component_lot,
json_list->'quantity' as quantity,
json_list->'operator id' as operator_id,
to_timestamp((json_list->>'timestamp')::int) as "timestamp"
from json_array_elements($json_text$::json) as json_list

```

---

<div class="post-metadata">

**Author:** ![jjj](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tulip.co/jjj/32/4542_2.png) [@jjj](https://community.tulip.co/u/jjj)\
**Post date:** [December 20, 2023, 9:42pm UTC](https://community.tulip.co/t/storing-objects-in-tables-and-extracting-from-json-strings/10106/2 "2023-12-20T21:42:20Z")

</div>

I was able to do the same in T-SQL but have not figured out how to replicate in a Tulip SQL connector

 ![image](https://us1.discourse-cdn.com/flex020/uploads/agilemfg/original/2X/5/5fae41d42b2e2e97bdaff786b60a99e536660241.png)

---

<div class="post-metadata">

**Author:** ![mellerbeck](https://avatars.discourse-cdn.com/v4/letter/m/e9bcb4/32.png) [@mellerbeck](https://community.tulip.co/u/mellerbeck)\
**Post date:** [December 23, 2023, 8:11pm UTC](https://community.tulip.co/t/storing-objects-in-tables-and-extracting-from-json-strings/10106/3 "2023-12-23T20:11:34Z")

</div>

Postgres as the universal fix my data is pretty powerful 🙂

---

<div class="post-metadata">

**Author:** ![thorsten.langner](https://avatars.discourse-cdn.com/v4/letter/t/4bbf92/32.png) [@thorsten.langner](https://community.tulip.co/u/thorsten.langner)\
**Post date:** [January 24, 2024, 3:31pm UTC](https://community.tulip.co/t/storing-objects-in-tables-and-extracting-from-json-strings/10106/4 "2024-01-24T15:31:27Z")

</div>

Did you also find a practical way to handle one object (not an array) in the expression editor?

I wanted to convert an Object to text, but the object is not selectable in the expression editor.  
I only can find the individual variables inside of it.

My Workaround was, to first copy the object variable, make it an object list (array) and then:  
`--> clear the array --> push object to the array --> make the array a text --> replace '[' and ']' --> done)`  
This feels a bit to bulky and “workaroundy” to me… is there a better option?

---

<div class="post-metadata">

**Author:** ![danielpomeranz](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tulip.co/danielpomeranz/32/9379_2.png) [@danielpomeranz](https://community.tulip.co/u/danielpomeranz)\
**Post date:** [January 24, 2024, 6:26pm UTC](https://community.tulip.co/t/storing-objects-in-tables-and-extracting-from-json-strings/10106/5 "2024-01-24T18:26:48Z")

</div>

Ya, this just looks like a weird oversight by Tulip with their object handling.

You are not able to access Objects in expressions, only their fields. But you are able to access Object Lists.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/agilemfg/original/2X/9/99c17e557c873b5c5835a844f16efb8d12bdd1c2.png)

![image](https://us1.discourse-cdn.com/flex020/uploads/agilemfg/original/2X/4/4d8d7704dd98e22543ec9f0c8f186e00a988bc64.png)

 ![image](https://us1.discourse-cdn.com/flex020/uploads/agilemfg/original/2X/3/33dd298a788763affc971862ff5a5e92d5c8547a.png)

---

<div class="post-metadata">

**Author:** ![jmlowden](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tulip.co/jmlowden/32/8645_2.png) [@jmlowden](https://community.tulip.co/u/jmlowden)\
**Post date:** [September 25, 2025, 7:58pm UTC](https://community.tulip.co/t/storing-objects-in-tables-and-extracting-from-json-strings/10106/6 "2025-09-25T19:58:32Z")

</div>

Trying this with large-ish connector output object lists and TOTEXT seems to only be able to handle 50 rows or so.

Are there other options for converting an connector output / object list to JSON or other text format for compact table storage, and then subsequent reconversion to Object List in a subsequent app session?

---

<div class="post-metadata">

**Author:** ![chieumaihong](https://avatars.discourse-cdn.com/v4/letter/c/ea666f/32.png) [@chieumaihong](https://community.tulip.co/u/chieumaihong)\
**Post date:** [August 22, 2026, 12:21am UTC](https://community.tulip.co/t/storing-objects-in-tables-and-extracting-from-json-strings/10106/7 "2026-08-22T00:21:33Z")

</div>

> [@danielpomeranz](#):
>
> ```auto
> -- For more info go here: postgresql.org/docs/9.3/functions-json.html
> 
> ```

Do you just use a dummy server to set up the environment?

---

<div class="post-metadata">

**Author:** ![danielpomeranz](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tulip.co/danielpomeranz/32/9379_2.png) [@danielpomeranz](https://community.tulip.co/u/danielpomeranz)\
**Post date:** [August 24, 2026, 11:59am UTC](https://community.tulip.co/t/storing-objects-in-tables-and-extracting-from-json-strings/10106/8 "2026-08-24T11:59:33Z")

</div>

@chieumaihong All Tulip instances have a tulip hosted postgres database already connected called “Connectors Demo”.
