Sqlite select as JSON

Hi All

i there a way to get a SQLlite select to return as JSON?

Thanks t

May be other way will be there, however if you adjust your return response like this code, may be you could get it… pls ref here

Thanks

thats all very well if one had low level access to the SQLlite datebase and table query which one doesnt (as far as I can tell)???

the QUERY block is obviously not written this way

SELECT

json_group_array(

json_object(‘full_name’, full_name, ‘created’, created)

) AS json_result

FROM (SELECT * FROM users ORDER BY created);

UNLESS

I use

elementblock014
and do a JSON QUERY???

What do you think>

why dont you try and test it?

just did. Nothing came back

Does this query make sense?

SELECT json_group_array(
json_object(
‘tank_house_no’, tank_house_no,
‘tank_street_name’, tank_street_name,
‘tank_unique_id’, tank_unique_id)
)
AS
json_result FROM (SELECT * FROM online_offline)

Thanks… will check it out.

but bfr i leave…

all in a days work when you dont know WHAT YOU ARE DOING :grinning:

Nope… still no clue!

It cant be THAT difficult~~!!!

Unless you have a rooted phone and the correct tools, you won’t be able to compile a version of sqlite on your device that has json format output. Even then, this will only work on that device…

Thanks…

I tried everything and eventually gave up on that one.

So the question remains.

Is there no way to return the data in JSON format in SQLlite which is crazy because one might have thought a RAW QUERY would have been just that! Obviously NOT!

t

Make a dictionary as the table names, then as values , you can select all from tables from index 2.
Thats how i did it