Replies: 3 comments 5 replies
-
Hello!
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Yes, i tried it and it works, but i absolutely dont know how to use an api
Thanks you for the JavaScript. I'll try this.
Le dim. 24 mars 2024, 07:43, Ophir LOJKINE ***@***.***> a
écrit :
… Hello!
Did you have a look at the json component?
https://sql.ophir.dev/documentation.sql?component=json#component
It allows you to make your query results available as a small API.
Then, in JavaScript, you can use:
const res = await fetch("my_file.sql");const my_data = await res.json();
—
Reply to this email directly, view it on GitHub
<#274 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOYEXY4LTKRBEED7L7MGXE3YZZYYZAVCNFSM6AAAAABFE6T3VKVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DQOJQHE4DI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
3 replies
-
maybe it will be a good example in the doc, for the json component, on how to create a json from a table : SELECT
'json' as component,
json_group_array(json_object('field1', m.myfield1, 'field2', m.myfield2 ) as contents
FROM my_table as m
WHERE m.myfield1 like 'my_value' and get the result. If the table contains constructors and cars : [
{"constructor":"Mercedes","Car":"SLK"},
{"constructor":"Ferrarri","Car":"F40"},
{"constructor":"Honda","Car":"NSX"}
] |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I put this here, as a new conversation, i think it can be useful.
I have a query like this :
The result is a json array like this :
how can i get this result in a page, inside the html code ? can i use the text component ?
Thank you again
Beta Was this translation helpful? Give feedback.
All reactions