Splitting text in JSON output from API

Hello!

I’m using Read JSON and get value by key after calling OpenAI JSON. Here is the output:

I’d like to display the numbered list for each heading with each numbered item on a new line like this:

I’ve tried every regex, split by, and find and replace I can think of. Tried displaying it as JSON safe as well.

Here’s the output i’m currently getting.

What can I do to put each numbered item on a new line?

There’s a catch, I’m using autobinding so users can edit the output. Thinking about disabling this but I have so many it will take forever. Any thoughts are welcomed.

You could ask the AI to put a unique symbol behind each point on your list for example $$enter$$. When you receive the result in bubble, all you need to do is :find&replace $$enter$$ for a real “enter”. :slight_smile:

1 Like

I think you can use format as :text or :join with for you case because you already have a list of text.

1 Like

That’s a great idea. And I tried it. The issue is it saves to the database as a list and is separated by commas so the output is this:

Also happening if I save as JSON safe and find and replace. The output is the same:

I have so many of these features adding another API call is time consuming but also WUs are a factor. Was hoping there was a quick fix!

Thank you for your help!

One of the issues is the comma separating each list item. It’s too database heavy to save each list item plus I want the user to be able to edit.

Could you explain in a bit more detail? Not sure I know how to implement what you’re thinking.

Thanks so much @Jici !

If I make changes to the text after I save the text this seems to work.

Seems like there should be a way to do this on the initial save to database.

Actually, the response from API is already a list of text no? Why not to store it as a text list? Change Weakness text to list of text. Use set list.
For display, you can use a) repeating group (set to list of text) b) :join with “line_break” or c) :format as text. All of that will work.

However, using a repeating group will make thing easier if you want the user to be able to edit each line item

1 Like

Gotacha! That works. I may be too wrapped up in this. My preference is to use autobinding so users can save easily and if I don’t I run into formatting issues down the road if they don’t save properly.

But it works.

First block is using: Splitting text in JSON output from API - #6 by will

Second block is setting a text list using :join with “line_break” - But again, can’t autobind with this method.

Thanks though! Good info to have!

1 Like

Is this using Multiline text field? To be able to use autobind, you will need to keep text field instead of list of text.

2 Likes

This is using a multiline input styled to look like regular text.

Any work around to get a list of texts to display on autobind multiline input?

Best workaround I can find is Splitting text in JSON output from API - #6 by will which works.