Converting JSON to a Bulleted List

I have the following JSON, which is dynamically created, meaning the # could vary.

[
  "8 oz spaghetti",
  "2 chicken breasts, diced",
  "1 cup broccoli florets",
  "1 bell pepper, sliced",
  "1 cup cherry tomatoes, halved",
  "1 cup mushrooms, sliced",
  "1 cup spinach",
  "2 cloves garlic, minced",
  "1 small onion, chopped",
  "1/2 cup white wine",
  "2 tbsp olive oil",
  "1/2 tsp paprika",
  "1/2 tsp chili flakes",
  "Salt to taste",
  "Black pepper to taste"
]

I would like to convert it to Markdown to display as the following:

#### Ingredients
- 8 oz spaghetti
- 2 chicken breasts, diced
- 1 cup broccoli florets
- 1 bell pepper, sliced
- 1 cup cherry tomatoes, halved
- 1 cup mushrooms, sliced
- 1 cup spinach
- 2 cloves garlic, minced
- 1 small onion, chopped
- 1/2 cup white wine
- 2 tbsp olive oil
- 1/2 tsp paprika
- 1/2 tsp chili flakes
- Salt to taste
- Black pepper to taste

Currently using a Generate Text AI column, which works fine, but looking to see if there is a better / not very complex way that doesn’t consume an update.

I was able to figure out using the Miracle Method to just display as a List collection, but determined that the list won’t work and need it in Markdown.

Thanks!

Have you tried a Template column?

You can link in your JSON as usual, and then replace things like the "s and commas with nothing. If you can (I’m not fluent in JSON), add a dash after the quote symbol.

[
  "- 8 oz spaghetti",
  "- 2 chicken breasts, diced",
  "- 1 cup broccoli florets",
  "- 1 bell pepper, sliced",
  "- 1 cup cherry tomatoes, halved",
  "- 1 cup mushrooms, sliced",
  "- 1 cup spinach",
  "- 2 cloves garlic, minced",
  "- 1 small onion, chopped",
  "- 1/2 cup white wine",
  "- 2 tbsp olive oil",
  "- 1/2 tsp paprika",
  "- 1/2 tsp chili flakes",
  "- Salt to taste",
  "- Black pepper to taste"
]

Then, paste this into a rich text component and it should be working a-ok.

image
image

Hope this helps!

Hmm interesting. Actually gave me an easier way than a bunch of splits and joins and replaces. So I just found out that if you put JSON into a Template, it actually strips out all the [ ] and “ “‘s automatically.

I changed my prompt to add a - in front of every ingredient but it basically makes all the ingredients into 1 giant paragraph with a single bullet point.

Replace your comma with a carriage return (Enter key).

Thanks, that worked! Something so easy… lol

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.