How to split one AI prompt output (JSON) into multiple columns in Glide?

When clicking the button Generate Text, the AI creates 6 different texts in one go.

Is it possible to split these 6 texts from a single prompt into 6 different columns using JSON?
Right now, Glide only gives me one output field.

The goal is that the 6 texts from one prompt are written into a collection, but each style (text) should end up in its own column in that collection.

I also don’t want to trigger 6 separate prompts, because that would be more expensive.

Chat Gpt make this Prompt (Json)

JSON-Struktur:

{
“emotional”: “Posttext inkl. Emojis & Hashtags”,
“trendy”: “Posttext inkl. Emojis & Hashtags”,
“informative”: “Posttext inkl. Emojis & Hashtags”,
“storytelling”: “Posttext inkl. Emojis & Hashtags”,
“inspirational”: “Posttext inkl. Emojis & Hashtags”,
“image_ideas”: “- Idee 1\n- Idee 2\n- Idee 3”,
“video_ideas”: “- Idee 1\n- Idee 2\n- Idee 3”
}

1 Like

hi marc, this one can be easily resolved. simply prompt your AI to strictly return each line as a json object inside an array. this means that your output must look like this: [ { "emotional": "Posttext inkl. Emojis & Hashtags" }, { "trendy": "Posttext inkl. Emojis & Hashtags" }, { "informative": "Posttext inkl. Emojis & Hashtags" }, { "storytelling": "Posttext inkl. Emojis & Hashtags" }, { "inspirational": "Posttext inkl. Emojis & Hashtags" }, { "image_ideas": "- Idee 1\n- Idee 2\n- Idee 3" }, { "video_ideas": "- Idee 1\n- Idee 2\n- Idee 3" } ]

1 Like

You can keep the output like that, and use query JSON to query them into separate columns.

1 Like

@Marc1 then you can use the json query columns in a server side workflow or your glide tables to extract any single key value pair.

use the json query column by feeding the input as the AI’s output and the query like this: [2] for the seocnd object or [4] for the 4th object

1 Like

Many Thanks to you!

Thanks everyone :slight_smile: I managed to get all of that working, but now I’m facing the next problem.

I’d like the output to be displayed in a Collection with 8 entries.

Right now, when I add the individual styles as input, they all stay in a single column.
What I want is for each style to have its own column.

Do I need to create a separate Collection for each style?
Or is the only option to handle it with 8 different Rich Text components and 8 inputs?

I added a new field (211) with Add, but I can’t insert my own style there, nor can I delete it again.

I hope you can understand my overall problem…

1 Like

I recommend going to Loqode School and joining. Marco has a system using helper tables to split out the JSON into separate entries.

@Marc1 .. details from a single column is very difficult to display across many rows in a collection.. there are a few work arounds but the easiest and most robust way to do this is to essentially have your workflow loop through all 8 outputs and add a row in the target table for each of the 8 outputs. so 8 outputs = 8 rows.. that can easily be displayed in any collection.. kanban, list etc

try using manual trigger workflow to achieve this

Hi, thank you so much! I will try it.

The customer is supposed to provide input, and the app should generate a response via AI with many different answers. There are several problems here. If I just use a rich text component, it results in a lot of text and becomes very confusing. I’ve now discovered “Hints,” which look a bit more structured thanks to the frames, but unfortunately only specific frame colors are available. I tried solving this with 6 containers and 6 rich texts, but the background colors of the containers aren’t particularly good either. Why is Glide so limited here?

The next problem is that the user can’t copy the texts and simply use them…


There are two ways to implement it:

  1. Input and output on the same page – but it’s hard to separate them properly since I can’t use all colors."

  1. First page with input, second page with collection output as JSON divided into different categories, and third page with a detail screen
  2. .

Actually, I’m starting to think that Glide is too complex for me. Simple things like changing colors, modifying buttons, or adjusting container backgrounds aren’t easily possible. I do have the Maker plan, but I still miss many simple features

@Marc1 i think there’s something in the data architecture that’s not quite right..

i am unable to pinpoint the issue.. but if your goal is to make a social media post generator, it’s actually very easy to make on glide, especially if you have all these categorical dvisions.

here’s a checklist of what ideal architecture would look like:

  1. a users table (use roles for deep access rights)
  2. a categories table (list of different categories)
  3. a posts table (each row represents an individual post)

as for ui customisation limits in glideapps, you can simply use custom CSS to enhance your components and app

if there’s anything else that is missed out, could you list an outline of your app (what it does and what you’ve built), here? other experts and i can identify the problem in this thread itself and help you out

I showcase how to do this here (I think around minute 13:00):

1 Like