'go to specific camp in json fastapi
Hi actually im new in fastapi and now im trying to do the next:`
formData = [
{
"page":1,
"fields": [
{
"component": "options",
"label": busqueda_pregunta,
"_uid": busqueda_id,
"options": [
{
"label": busqueda_nombre_1,
"value": busqueda_id_opcion_1
},
{ "label": busqueda_nombre_2, "value": busqueda_id_opcion_2 },
{ "label": busqueda_nombre_3, "value": busqueda_id_opcion_3 },
{ "label": busqueda_nombre_4, "value": busqueda_id_opcion_4 }
]
},
{
"page":2,
"fields": [
{
"component": "options",
"label": busqueda_pregunta,
"_uid": busqueda_id,
"options": [
{
"label": busqueda_nombre_1,
"value": busqueda_id_opcion_1
},
{ "label": busqueda_nombre_2, "value": busqueda_id_opcion_2 },
{ "label": busqueda_nombre_3, "value": busqueda_id_opcion_3 },
{ "label": busqueda_nombre_4, "value": busqueda_id_opcion_4 }
]
},
`This is my JSON and when i send the get response i want to the response give me only this:
"page":2,
"fields": [
{
"component": "options",
"label": busqueda_pregunta,
"_uid": busqueda_id,
"options": [
{
"label": busqueda_nombre_1,
"value": busqueda_id_opcion_1
},
{ "label": busqueda_nombre_2, "value": busqueda_id_opcion_2 },
{ "label": busqueda_nombre_3, "value": busqueda_id_opcion_3 },
{ "label": busqueda_nombre_4, "value": busqueda_id_opcion_4 }
]
},
im trying the next
@router.get('/{id_question}/{page}',)
async def show(id_question, page: int, db: Session = Depends(get_db)):
search_question = db.query(models.vw_preguntas_opciones.pregunta).filter(models.vw_preguntas_opciones.id_pilar == id_pilar).first()
buscar_pagina = {"page":page}
i hope i explain what i try to do and get a help with this problem thank you to all
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
