From Clomosy Docs
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
It is used to convert JSON data into a TCLJSONQuery object and process the data by performing operations on it. Let's take a look at how it can be used: | "JSON Data Source Query" is a term that typically refers to a query or resource definition used by an application or a database system to perform operations like data retrieval, updating, or querying in JSON format. JSON is a popular format for data transport and storage, and many programming languages and database management systems provide the capability to work with JSON data.<br> | ||
In the context of Clomosy, it allows for data to be retrieved in "ClDataSetFromJSON" format, which can then be transformed into a dataset.<br> | |||
It is used to convert JSON data into a TCLJSONQuery object and process the data by performing operations on it. Let's take a look at how it can be used:<br> | |||
A variable belonging to the TCLJSONQuery object is declared. Then, this object is created. | A variable belonging to the TCLJSONQuery object is declared. Then, this object is created. | ||
Revision as of 10:59, 11 October 2024
"JSON Data Source Query" is a term that typically refers to a query or resource definition used by an application or a database system to perform operations like data retrieval, updating, or querying in JSON format. JSON is a popular format for data transport and storage, and many programming languages and database management systems provide the capability to work with JSON data.
In the context of Clomosy, it allows for data to be retrieved in "ClDataSetFromJSON" format, which can then be transformed into a dataset.
It is used to convert JSON data into a TCLJSONQuery object and process the data by performing operations on it. Let's take a look at how it can be used:
A variable belonging to the TCLJSONQuery object is declared. Then, this object is created.
var qry:TCLJSONQuery;
qry := TCLJSONQuery.Create(nil);
JSON data is transformed into a TCLJSONQuery object. This object contains the JSON data and allows query operations to be performed on it. Following this, operations can be performed on this data.
Example:
- Base Syntax
var
qry:TCLJSONQuery;
begin
try
qry := TCLJSONQuery.Create(nil);
qry := Clomosy.ClDataSetFromJSON('[{"name":"Anna","age":20},{"name":"David","age":27}]');
//ShowMessage(qry.getJSONString);
with qry do
begin
if Found then
begin
First;
while not EOF do
begin
ShowMessage(FieldByName('name').AsString);
Next;
end;
end;
end;
except
ShowMessage('Exception Class: '+LastExceptionClassName+' Exception Message: '+LastExceptionMessage);
end;
end;
- TRObject Syntax
var
qry:TCLJSONQuery;
{
try
qry = TCLJSONQuery.Create(nil);
qry = Clomosy.ClDataSetFromJSON('[{"name":"Anna","age":20},{"name":"David","age":27}]');
//ShowMessage(qry.getJSONString);
with qry do
{
if (Found)
{
First;
while (not EOF)
{
ShowMessage(FieldByName('name').AsString);
Next;
}
}
}
except
ShowMessage('Exception Class: '+LastExceptionClassName+' Exception Message: '+LastExceptionMessage);
}
}