You are not logged in.
I need to understand how to do this with mormot this (the code must be compatible with delphi and lazarus)
parse a JSON object (Respuesta string)
var
soDetectado, soaMessage : SuperObject;
begin
soDetectado := SuperObject.so(Respuesta);
Detectado.IdTransaccion := soDetectado[strListaDetectados+'[0].IdTransaccion'].AsString;
Detectado.Identificador := soDetectado[strListaDetectados+'[0].Identificador'].AsString;
for soaMessage in soDetectado[strListaDetectados+'[0].Mensajes'] do
begin
NewMessage := Detectado.Mensajes.Add;
NewMessage.Mensaje := soaMessage['Mensaje'].AsString;
NewMessage.IDTipoMensaje :=(soaMessage['IdTipoMensaje'].AsInteger);
end;
end;
populate a JSON object
soEstructura := XSuperObject.TSuperObject.Create;
soEstructura.S['Llave'] := 'xxxxx';
soEstructura.I['FechaRegistro'] := traducirFecha(now);
with soEstructura.O['Informacion'] do
begin
S['Denominacion'] := lSomeDataset.FieldByName('DENOMINACION').AsString.ToUpper;
S['Departamento'] := lSomeDataset.FieldByName('DEPARTAMENTO').AsString.ToUpper;
end;
with soEstructuraEstacion.O['Estructura'] do
begin
with O['Software'] do
begin
S['Empresa'] := 'SOME';
end;
end;
aPos := 0;
while (not lRFID.EOF) do
begin
with A['RFID'].O[aPos].AsObject do
begin
S['Codigo'] := lRFID.FieldByName('CODIGO').AsString.ToUpper;
end;
lRFID.Next;
Inc(aPos);
end;
Im using superobjects and Xsuperobject but is not fully compatible with freepascal right now.
Thanks for any point to a sample or tutorial.
Best regards.
P.S. I never user mormot before.
Offline
You should find your answers here: http://synopse.info/forum/viewtopic.php?id=1631
Offline
You should find your answers here: http://synopse.info/forum/viewtopic.php?id=1631
Thank you!
Offline
See the documentation about this point:
http://synopse.info/files/html/Synopse% … ml#TITL_80
Offline
I start migrating on my test it:
Work fine on Delphi,
fails in windows/linux i386 (fpc 3.1 + lazarus 1.7)
unit SynCommons;
{$ifdef CPUINTEL}
procedure TestIntelCpuFeatures;
var regs: TRegisters;
begin
regs.edx := 0;
regs.ecx := 0;
GetCPUID(1,regs);
PIntegerArray(@CpuFeatures)^[0] := regs.edx;
PIntegerArray(@CpuFeatures)^[1] := regs.ecx;
GetCPUID(7,regs);
PIntegerArray(@CpuFeatures)^[2] := regs.ebx;
PByteArray(@CpuFeatures)^[12] := regs.ecx;
end;
{$endif CPUINTEL}
SynCommons.pas(61334,3) Error: Identifier not found "GetCPUID"
Work perfect in linux ARM (fpc 3.1 + lazarus 1.7)
Any easy fix? As i need right now on linux/arm and win32 im not worried, but want to know if will be fixed in a near future.
Best regards.
Last edited by donaldshimoda (2016-12-22 13:07:44)
Offline
Any easy fix? As i need right now on linux/arm and win32 im not worried, but want to know if will be fixed in a near future.
Best regards.
Hi , now i need it working on linux 386 and X64. How to fix this problem? latest version takes from the repos.
Best regards.
Offline