Need advice on JSON field

Options

Hello everyone!

I am new to Xano and using code as well but I need to learn so here I am.

I have a database that has a list of weeks in them and then a JSON field that will sort a list of "splits", Inside each split is a list of "exercises" and inside each exercise is a list of "sets" (along with other information too).

What I am trying to do is that the user can select how many splits, exercise, and sets, and then the JSON will create it. The users need to be able to record reps and weight on the front end that will then be saved to a database or in the best place.

Can someone talk me through how to make this happen?

Currently have this JSON

{
"workout_splits": [
{
"exercise": {
"exercise_name": "Exercise 1",
"sets": [
{
"reps": 10,
"weight": "50 lbs"
},
{
"reps": 12,
"weight": "55 lbs"
},
{
"reps": 8,
"weight": "45 lbs"
}
]
}
},
{
"exercise": {
"exercise_name": "Exercise 2",
"sets": [
{
"reps": 10,
"weight": "60 lbs"
},
{
"reps": 12,
"weight": "65 lbs"
},
{
"reps": 8,
"weight": "55 lbs"
}
]
}
}
// Add more workout splits and exercises as needed based on trainer's input
]
}

But am lost on how to make it dynamic based on the users selection on how many split, exercises or sets

Tagged:

Answers