From Clomosy Docs

(Created page with "test")
 
No edit summary
Line 1: Line 1:
test
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:'''<br>
var
  qry:TCLJSONQuery;
  jsonStr:string;
begin
    try
      qry := TCLJSONQuery.Create(nil);
      qry := Clomosy.ClDataSetFromJSON('[{"name":"Anna","age":20},{"name":"David","age":27}]');
      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;

Revision as of 14:54, 22 August 2023

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:

var
  qry:TCLJSONQuery;
  jsonStr:string;
begin
   try
     qry := TCLJSONQuery.Create(nil);
     qry := Clomosy.ClDataSetFromJSON('[{"name":"Anna","age":20},{"name":"David","age":27}]');
     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;