Extracting variable responses from ChatGPT API and posting into repeating groups

Excuse the post length here but I’m trying to be as detailed as possible in case someone has a recommendation for a better way that I can structure this.

I’m building a marketplace type website where users can create, share, and find recommendations about parks. The database structure I’ve set up is

  1. User
  • ID
  • Name
  • The basics
  1. Country
  • ID
  • Name
  1. City
  • ID
  • Name
  1. Category
  • Category ID
  • Category Name (Garden, Ball Field, National Park, Recreational, Children’s Park)
  1. Park
  • Park Name
  • Park ID
  • User ID
  • City ID
  • Category ID
  • Website
  • Address

What I’ve done is connected via Bubble API connection to ChatGPT and that configuration is fine. I have a Submit flow where someone can submit a general recommendation about a Park or several Parks and ChatGPT response works well and I can show it.

HERE IS WHERE I’M STUCK:
My goal is to be able to save the data on a user’s profile so that I can see a user’s page and see their info listed by country and then city. But I don’t know the best way to extract the json response into the corresponding field for the recommendation. I’ll give an example

Patty’s Park Recommendations
Countries: USA, France
(user clicks into USA)

Cities: New York City, NY | Miami, Florida
(user clicks into Miami, Florida)

Parks:

  • South Point Park | Recreational | 1 South Point Drive
  • Flamingo Park | Ball Sports, Children’s Park, Recreational |

In this example you’ll see the first park recommended HAS an address, the second one does not. Similarly, the first park has only ONE category but the second one has multiple. It’s because of these varying responses that I’m having trouble finishing the integration. If each park had exactly the same number of responses then I know I could use a plugin for “read json and get value by key” to understand what response is equivalent to what and I’d be okay but I don’t know how many parks people will upload in their recommendations and I don’t know how large the responses would be.

So to summarize I’d love advice on the following:

  1. When I don’t know how many inputs users will be requesting via an API what is the best way to structure the UX response to that request? (I.e. they insert 5 recommendations or 10, the UX adjusts)
  2. When I don’t know how many responses will be included for each data point, how do I structure or save the data? (i.e. their response lists 4 park categories instead of 1).

Any help is much appreciated!