Thanks
On Tuesday 18 June 2024 at 17:06:30 UTC+5:30 mr.kri...@gmail.com wrote:
>
> import sqlite3
> import json
>
> # Reconnect to the SQLite database
> conn = sqlite3.connect('example.db')
> cur = conn.cursor()
>
> # Execute the query
> cur.execute("SELECT Name, Address FROM your_table")
>
> # F
import sqlite3
import json
# Reconnect to the SQLite database
conn = sqlite3.connect('example.db')
cur = conn.cursor()
# Execute the query
cur.execute("SELECT Name, Address FROM your_table")
# Fetch all rows from the executed query
rows = cur.fetchall()
# Get column names from the cursor descr
I want to convert my cursor.fetchall() response to JSON object.
Like example:
[
{Name: "XYZ-1", Address: "ABC-1"},
{Name: "XYZ-2", Address: "ABC-2"}
]
currenty I am getting like below
[
["XYZ-1","ABC-1"],
["XYZ-2","ABC-2"]
]
Please help me how to parse in my custom models
--
You received th