Jump to content

Search the Community

Showing results for tags 'json'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Delphi-Version

Found 22 results

  1. Greetings from St Louis, Missouri USA I'm using and learning C++ Builder 11 professional. I want to make a windows app that displays telemetry data from a zigbee gateway on the local internal subnet. It sends periodic telemetry base64 data via (I'm guessing...) jason/ajax. The zigbee gateway has a web page "http://" + ip + "/debug.html" that displayes the zigbeeData in a scrolling window. That scrolling windows is the only data that I want to to capture. I'm wondering if there are a few drop in components I can use to setup / collect json/ajax pairs from a web server on the local subnet ? What is the easiest way to setup a pipe to collect this (presumably JSON) zigbeeData ? What Rad Studio components should I look for ? I know how to process the base64 data. I wrote the embedded zigbee code which does that part. This "zigbee gateway" I have all the source code for it. Its a microchip ethernet gateway with a mini TCP stack. Its handing it off to a mini web server that I did not write. Attached is ajax.xml, debug.html (what I did not write) and a picture of a web browser displaying the base64 strings in a scrolling window. I just need help with how to use C++ Builder 11 professional to it collect it from "http://" + ip + "/debug.html" I'm a C/C++ software engineer with many years experience doing low level C/C++ programing. I've been using Borland,Inprise,Radstudio C++ for high level programming and then lots of embedded compilers for embdedded apps. I'm very familar with TCP and berkley sockets. I don't know much about Web gets, puts, json or java. I presume some sort of layer uses a TCP port to send/receive packets. I know how to find the local IP address of the gateway using Dns GetHostName API. I presume the IP will be "pluged" in to something. Hopefully a RAD Studio component that I drop on a form, define the json fields/pairs and then set the ip address. Do you have any suggestions, tips recommendations ? Best regards Dan ajax.xml debug.htm
  2. Since years, our Open Source mORMot framework offers several ways to work with any kind of runtime arrays/objects documents defined, e.g. via JSON, with a lot of features, and very high performance. Our TDocVariant custom variant type is a powerful way of working with such schema-less data, but it was found confusing by some users. So we developed a new set of interface definitions around it, to ease its usage, without sacrificing its power. We modelized them around Python Lists and Dictionaries, which is proven ground - with some extensions of course. Two one-liners may show how our mORMot library is quite unique in the forest/jungle of JSON libraries for Delphi (and FPC): +] assert(DocList('[{ab:1,cd:{ef:"two"}}]')[0].cd.ef = 'two'); assert(DocList('[{ab:1,cd:{ef:"two"}}]').First('ab<>0').cd.ef = 'two'); Yes, this code compiles and run on Delphi - even the antique Delphi 7. 😆 If you compare e.g. to how the standard JSON library works in the RTL, with all its per-node classes, you may find quite a difference! And there is no secret in regard to performance, that our JSON processing is fast. More info: https://blog.synopse.info/?post/2024/02/01/Easy-JSON-with-Delphi-and-FPC
  3. I am trying to parse a json response to retrieve a nested record without any success. Example of the json response is: { "status": "1", "info": "success", "page_info": { "total_page": "1", "record_per_page": "1", "current_page": "1", "total_record": "1" }, "records": [ { "machine_id": "25884", "imei": "", "install_date": "", "last_report": "", ....... ....... "coin_mech": { "coin_mech_id": "12345", "cm_model": "", "serial_no": "", "revision": "", "coin_in_tube": "", "tubes": [ { "tube_id": "3469107", "tube_no": "4", "coin_unit": "100", "coin_count": "93", "coin_inserted": "0", "coin_dispensed": "0", "tube_full": "0" }, { "tube_id": "3469105", "tube_no": "5", "coin_unit": "200", "coin_count": "9", "coin_inserted": "0", "coin_dispensed": "0", "tube_full": "0" } ] } }] } The info I am after is the records for "tubes" which can contain up to 5 records (2 in the above example) . Have tried several of the coding examples that I found in stackoverflow without success although I have not found an example with a similar record structure. Can someone please advise me on how to retrieve those records (would be great if in a dataset). Thanks in advance. Bill Zwirs
  4. I have a problem with Delphi Alexandria and it's JSON methods, maybe I just do it wrong and would like to get help. Here is my demo project that show the problem. program Project12; {$APPTYPE CONSOLE} {$R *.res} uses Winapi.Windows, System.Classes, System.SysUtils, System.IOUtils, System.JSON; type TMyJsonRec = packed record MyInteger: Integer; MyInt64: Int64; MyUInt64: UInt64; MyDWORD: DWORD; MyDouble: Double; MyBoolean: Boolean; MyString: string; end; procedure SaveJsonToFile(const AJsonObject: TJSONObject; const AFileName: string); var JsonText: string; StreamWriter: TStreamWriter; begin JsonText := AJsonObject.ToString; // is this the problematic part? StreamWriter := TStreamWriter.Create(AFileName, False, TEncoding.UTF8); try StreamWriter.Write(JsonText); finally StreamWriter.Free; end; end; procedure SaveRecordToJson(const ARecord: TMyJsonRec; const AFileName: string); var JsonObject: TJSONObject; begin JsonObject := TJSONObject.Create; try JsonObject.AddPair('MyInteger', TJSONNumber.Create(ARecord.MyInteger)); JsonObject.AddPair('MyInt64', TJSONNumber.Create(ARecord.MyInt64)); JsonObject.AddPair('MyUInt64', TJSONNumber.Create(ARecord.MyUInt64)); // this does not work as I would have thought it does, when it exceed Int64 range it break JsonObject.AddPair('MyDWORD', TJSONNumber.Create(ARecord.MyDWORD)); JsonObject.AddPair('MyDouble', TJSONNumber.Create(ARecord.MyDouble)); JsonObject.AddPair('MyBoolean', TJSONBool.Create(ARecord.MyBoolean)); JsonObject.AddPair('MyString', ARecord.MyString); SaveJsonToFile(JSonObject, AFileName); finally JsonObject.Free; end; end; function LoadRecordFromJson(const AFileName: string): TMyJsonRec; var JsonObject: TJSONObject; begin JsonObject := TJSONObject.ParseJSONValue(TFile.ReadAllText(AFileName)) as TJSONObject; try Result.MyInteger := JsonObject.GetValue('MyInteger').AsType<Integer>; Result.MyInt64 := JsonObject.GetValue('MyInt64').AsType<Int64>; Result.MyUInt64 := JsonObject.GetValue('MyUInt64').AsType<UInt64>; // this does not work as I would have thought it does, when it exceed Int64 range it break Result.MyDWORD := JsonObject.GetValue('MyDWORD').AsType<DWORD>; Result.MyDouble := JsonObject.GetValue('MyDouble').AsType<Double>; Result.MyBoolean := JsonObject.GetValue('MyBoolean').AsType<Boolean>; Result.MyString := JsonObject.GetValue('MyString').Value; finally JsonObject.Free; end; end; var MyRecord1, MyRecord2: TMyJsonRec; begin // Initialize the record MyRecord1.MyInteger := High(Integer); MyRecord1.MyInt64 := High(Int64); MyRecord1.MyUInt64 := High(UInt64); MyRecord1.MyDWORD := High(DWORD); MyRecord1.MyDouble := 123.456; MyRecord1.MyBoolean := True; MyRecord1.MyString := 'Hello, World!'; Writeln('Original record:'); Writeln('MyInteger: ', MyRecord1.MyInteger); Writeln('MyInt64: ', MyRecord1.MyInt64); Writeln('MyUInt64: ', MyRecord1.MyUInt64); Writeln('MyDWORD: ', MyRecord1.MyDWORD); Writeln('MyDouble: ', MyRecord1.MyDouble); Writeln('MyBoolean: ', MyRecord1.MyBoolean); Writeln('MyString: ', MyRecord1.MyString); SaveRecordToJson(MyRecord1, '.\test.json'); MyRecord2 := LoadRecordFromJson('.\test.json'); // Output the loaded record Writeln('Loaded record:'); Writeln('MyInteger: ', MyRecord2.MyInteger); Writeln('MyInt64: ', MyRecord2.MyInt64); Writeln('MyUInt64: ', MyRecord2.MyUInt64); Writeln('MyDWORD: ', MyRecord2.MyDWORD); Writeln('MyDouble: ', MyRecord2.MyDouble); Writeln('MyBoolean: ', MyRecord2.MyBoolean); Writeln('MyString: ', MyRecord2.MyString); ReadLn; end. I am unsure if it is the saving part or the reading part.
  5. I have used Rest Debugger to set up my components (Client, Request, Response, DatasetAdapter and TDFMemTbl) to populate the MemTable with all the records from the "records' part of the response. When I execute the Request I get a Response Ok, part of which is shown below: {"status":"1","info":"success","page_info":{"total_page":"21","record_per_page":"50","current_page":"1","total_record":"1029"},"records":[{"machine_id":"16748","imei":"8615850........................ If I right click the MemTable to view the "records" data all I get is the 50 records (ie. "records_per_page":"50"). I simply want to use the MemTable dataset in a report (using Fast Report) so need ALL records available which, according to the response should be 1029. The report I have created only shows the 50 records at this stage. So my question is......how do I get all the records from the Response to show in the MemTable? Any assistance would be appreciated. Thanks Bill
  6. Hi all, First of all, I apologise if what is required is poorly described, but unfortunately I know very little about networks and their knowledge. But let's get down to facts. In an industrial machine control application, I have inserted a server, a TCP/IP server based on JSON messages, which allows the connection of several clients at the same time and enables motor movement commands to be executed or information to be retrieved from the system. A client programme connects to the server and from then on can do anything with the device it has connected to. At this point, security problems arise, especially for the operator standing at the machine, since a malicious client intruding into the network could trigger dangerous operations for the operator standing near the machine and unaware that someone unauthorised has taken control of it remotely. Now I have been asked to add a security layer, but as a complete ignoramus on the subject, I deal mainly with compilers of languages and UI environments and not with networks, I was wondering how to add a system of certification and authorisation of the client to the server connection. For the client I use python while the server is done with Indy 10 using TIdTCPServer. Thank you in advance for any suggestions and help. Best regards Silverio
  7. Frédéric

    TGUID to Json

    Hello, I'm currently using RAD Studio 11.2 and just wondering why the standard Delphi Json library (Rest.Json or Data.DBXJsonReflect) is not able to serialize a TGUID value ? Is this possible or I am missing something ? It fails with an 'insufficient RTTI available to support this operation' error. Sure I can add a converter, but it should at least be converted as a record (or to a string), or no ? How should this be handled ? Thanks ! Frederic
  8. Windows 7 Home 64bit Delphi XE7 Professional update 1 with FireDAC and Mobile add-on Indy version 10.6.1.518 Android version 10, (on smartphone) Android versions 4.4.4, and 4.4.2 (both on tablets) Issue/Problem: When I launch the app on Android, and click on the [Submit] button, the app shuts down when it tries to access the idhttp section here: idHttp1.get(url_address); It works fine under Windows FMX and VCL, just not Android. Can someone please help me resolve this? Thank you. History: Hi. I have been successfully creating small utility apps on my android devices (Galaxy S10+ (android 10) and tablets (android 4.x.x)) for the last 8 years. I've been playing around with a new windows project using API through OMdbAPI (an IMDB knock-off) to get quick movie/tv series info. The API is free for 1000 requests. I love it. It works well. Usage is simple, using the following -> [https://www.omdbapi.com/?t=Contact&apikey={8-dig-key-code}] as it will give back a JSON string (below), then I parse it to get back a two-column detail to visualize the data better. Later I plan to fine-tune it and display only certain info from it. Right now, I am simply debugging it on Windows 7 and Android. {"Title":"Contact","Year":"1997","Rated":"PG","Released":"11 Jul 1997","Runtime":"150 min","Genre":"Drama, Mystery, Sci-Fi","Director":"Robert Zemeckis","Writer":"James V. Hart, Michael Goldenberg, Carl Sagan","Actors":"Jodie Foster, Matthew McConaughey, Tom Skerritt","Plot":"Dr. Ellie Arroway, after years of searching, finds conclusive radio proof of extraterrestrial intelligence, sending plans for a mysterious machine.","Language":"English, Spanish, German, Russian","Country":"United States","Awards":"Nominated for 1 Oscar. 14 wins & 32 nominations total","Poster":"https://m.media-amazon.com/images/M/MV5BYWNkYmFiZjUtYmI3Ni00NzIwLTkxZjktN2ZkMjdhMzlkMDc3XkEyXkFqcGdeQXVyNDk3NzU2MTQ@._V1_SX300.jpg","Ratings":[{"Source":"Internet Movie Database","Value":"7.5/10"},{"Source":"Rotten Tomatoes","Value":"68%"},{"Source":"Metacritic","Value":"62/100"}],"Metascore":"62","imdbRating":"7.5","imdbVotes":"274,457","imdbID":"tt0118884","Type":"movie","DVD":"16 Dec 1997","BoxOffice":"$100,920,329","Production":"N/A","Website":"N/A","Response":"True"}
  9. Hello, I am developing on Delphi 11.1. I would like to read a JSON pair REST response received by TRESTResponse object. The response has the following format: {"OrderNo", "W00001987"}. In my first attempt to get the OrderNo value I used this code: OrderNoRESTResp.RootElement := 'OrderNo'; var S: string := OrderNoRESTResp.Content; Result := OrderNoRESTResp.JSONValue.ToString; But in the result were reported the double quotes aoround the order no. After I try with the following code and I get the right order no without double quotes: Jsv: TJSONValue := OrderNoRESTResp.JSONValue; try var Jso: TJSONObject := Jsv as TJSONObject; for var JPair: TJSONPair in Jso do Result := JPair.JSONValue.Value; Is the above code the correct one and the best way to retrieve a single Json pair returned from the TRESTResponse ? Thank you, Davide
  10. Here is the code: #include <REST.Json.hpp> ... TJson* formatter=new TJson(); Compilation successful, but linker says following: [ilink32 Error] Error: Unresolved external 'Rest::Json::TJson::' referenced from C:\USERS\ISKOR\DESKTOP\TJSONTEST\WIN32\DEBUG\UNIT1.OBJ How can that be? I use C++ Builder 10.1 Community Edition.
  11. I'm trying to use JSONPath via TJSONObject.FindValue in my program. I'm using Delphi 11. I broke it down to the easiest example and I still can't get it to work: { "name": "Chris", "value": 10000 } Path: $.name My Code after stripping away everything else: var myjson:=TJSONObject.ParseJSONValue('{"name": "Chris","value": 10000}'); var myval:=myjson.FindValue('$.name'); ergebnis.Text:=myval.Value; The JSON get's parsed, but the FindValue returns 'nul'. Am I doing something completely wrong?
  12. I'm working in Delphi 10.2 I will need to make Json object which would need to ignore empty integers, numbers or entire class. For Integers I've tried with attribute [SuppressZero] and it works OK but problem is that integer output is like string, not integer. Is there any solution for that? Example classes: TOtherClass = class private FStringField1: string; FIntegerField1: Integer; FDoubleField1: Double; published property StringField1: string read FStringField1 write FStringField1; property IntegerField1: Integer read FIntegerField1 write FIntegerField1; property DoubleField1: Integer read FDoubleField1 write FDoubleField1; end; TMainClass = class private FStringField: string; FIntegerField: Integer; FDoubleField: Double; FOtherClass: TOtherClass; published property StringField: string read FStringField write FStringField; property IntegerField: Integer read FIntegerField write FIntegerField; property DoubleField: Double read FDoubleField write FDoubleField; property OtherClass: TOtherClass read FOtherClass; public end; If I fill all fields I'll get result like this: { "StringField": "123", "IntegerField": 1, "DoubleField": 111.11, "OtherClass": { "StringField1": "999", "IntegerField1": 9, "DoubleField1": 999.99 } } What I need is that if integers and doubles are 0 then it shoud not exists in result, and if entire Class is empty than that class shoud not be in result Json. That means for: Integerfield=0, DoubleField=0.00, OtherClass->StringField1='', OtherClass->IntegerField1=0, OtherClass->doublefield1=0.00 the result shoud be: { "StringField": "123", } not { "StringField": "123", "IntegerField": 0, "DoubleField": 0.0, "OtherClass": { "StringField1": "", "IntegerField1": 0, "DoubleField1": 0.00 } } or { "StringField": "123", "IntegerField": 0, "DoubleField": 0.0, "OtherClass": { } } I've tried for "integer fields" something like Uwe Raabe did with Date fields and it works for integer values 0(zero) but for integers different from 0 problem is that the result in JSON is string not integer because StringConverter and StringReverter works with string. My idea for class with attribute [SupressZero] TOtherClass = class private FStringField1: string; [SuppressZero] FIntegerField1: Integer; [SuppressZero] FDoubleField1: Double; published property StringField1: string read FStringField1 write FStringField1; property IntegerField1: Integer read FIntegerField1 write FIntegerField1; property DoubleField1: Integer read FDoubleField1 write FDoubleField1; end; TMainClass = class private FStringField: string; [SuppressZero] FIntegerField: Integer; [SuppressZero] FDoubleField: Double; [SuppressZero] FOtherClass: TOtherClass; published property StringField: string read FStringField write FStringField; property IntegerField: Integer read FIntegerField write FIntegerField; property DoubleField: Double read FDoubleField write FDoubleField; property OtherClass: TOtherClass read FOtherClass; public end; My code for integer fields (did not try supressZero for Double and Class because this don't work for integer fields) type SuppressZeroAttribute = class(JsonReflectAttribute) public constructor Create; end; TSuppressZeroInterceptor = class(TJSONInterceptor) public function StringConverter(Data: TObject; Field: string): string; override; procedure StringReverter(Data: TObject; Field: string; Arg: string); override; end; implementation { SuppressZeroAttribute } constructor SuppressZeroAttribute.Create; begin inherited Create(ctString, rtString, TSuppressZeroInterceptor); end; { TSuppressZeroInterceptor } function TSuppressZeroInterceptor.StringConverter(Data: TObject; Field: string): string; var RttiContext: TRttiContext; iValue:integer; begin iValue := RttiContext.GetType(Data.ClassType).GetField(Field).GetValue(Data).AsType<Integer>; if (iValue = 0) then begin Result := EmptyStr; end else begin Result := iValue.ToString; end; end; procedure TSuppressZeroInterceptor.StringReverter(Data: TObject; Field, Arg: string); var RttiContext: TRttiContext; iValue:Integer; begin if (Arg.IsEmpty) or (Arg.StartsWith('0')) or (Arg.ToLower.Contains('null')) then begin iValue := 0; end else begin iValue := arg.ToInteger; end; RttiContext.GetType(Data.ClassType).GetField(Field).SetValue(Data, iValue); end; If looking only string and integer fields for first class result is: for StringField="123", IntegerField=0 { "StringField": "123" -> OK - there is no IntegerField } for StringField="123", IntegerField=123 { "StringField": "123", "IntegerField": "123" -> NOT OK - this shoud be without quotes "" } Is there some solution for "SupressEmptyValues" for integer, double and classes that can be done with JSonReflectAttribute and TJSONInterceptor or should I look for some other solution for my problem? Thanks for replays.
  13. Hi all. I'm new to JSON frameworks and I'm getting lost in a spoonful of water. In the Sydney help I've found this code: JSONValue := TJSONObject.ParseJSONValue('{"colors":[{"name":"red", "hex":"#f00"}]}'); Memo1.Lines.Add('READER:'); if JSONValue is TJSONArray then //... else if JSONVAlue is TJSONObject then Memo1.Lines.Add('colors'); Memo1.Lines.Add('name: '+ JSONValue.GetValue<string>('colors[0].name')); Memo1.Lines.Add('hex: '+ JSONValue.GetValue<string>('colors[0].hex')); Now this works fine but I need to read a client request so formatted: var Text: string; Command: string; JsonValue: TJSONValue; JsonValueArg: TJSONValue; begin // parse json JSONValue := TJSONObject.ParseJSONValue('{"cmd":"program.add.text", "txt":"for I := 0 to 100 do"}'); if not (JSONValue is TJSONObject) then Exit; // gets command type (in Command I've found the "cmd" value "program.add.text". ALL RIGHT!!!) if JSONValue.TryGetValue('cmd', Command) then Exit; // gets command argument txt (does not found the "txt" value and program EXITS!!!) if JSONValue.TryGetValue('txt', Text) then Exit; //... I can't change the JSON request string to contain an array as well as in the Embarcardero sample because reach from a customer program and I've checked with only JSON validator and seem to be fine. What was I've mistaken? Thank you in advance for your replies.
  14. Hi guys! I'm having a little problem, my rest api on horse (Backend, console application), it's working very nice, but, i'm about to receive about 1000 jsons, how can I control that? The response time 201 - Created is about 1 ~ 2 seconds for one json. Thanks.
  15. Erik Vestergaard

    JsonTypeInfo in Delphi?

    Hi I am trying to write a Delphi RESTCall using JSON. We allready have a javaclass that works. It is using this annotation to make Jackson able to parse correctly. @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, property = "className") But what is the correspondent construction in Delphi? My code: s := TJson.ObjectToJsonString(o90RpcCall); The error I get is this: <div>JSON parse error: Missing type id when trying to resolve subtype of [simple type, class java.lang.Object]: missing type id property 'className' (for POJO property 'args'); nested exception is com.fasterxml.jackson.databind.exc.InvalidTypeIdException: Missing type id when trying to resolve subtype of [simple type, class java.lang.Object]: missing type id property 'className' (for POJO property 'args') at [Source: (PushbackInputStream); line: 1, column: 181] (through reference chain: o90client.generel.JSONRPCCall["args"]->java.lang.Object[][0])</div></body></html> I guess it is because of the lack of annotation in my class
  16. Hello,I am learning to use the TJSONIterator(Readers and Writers JSON Framework) under delphi 10.3.3 and I found a russian link putting this into practice through the creation of an application assessing the negative impact on the environment: https://webdelphi.ru/. Firstly, i have a custom class definition named "NVOS.JsonParser.pas" and the "open-data-1.json" file, i don't know how to proceed However, I can't figure out already knowing that the result should look like: "App.png". open-data-1.json
  17. Consider this pseudo code uses Rest.Json; TDateClass = class private FHasDate: TDateTime; FNoDate: TDateTIme; public constructor Create; property HasDate: TDateTime read FHasDate write FHasDate; property NoDate: TDateTime read FNoDate write FNoDate; end; constructor TDateClass.Create; begin HasDate := Now; NoDate := 0; end; var Json: String; DateClass: TDateClass; begin DateClass := TDateClass.Create; Json := TJson.ObjectToJsonString(Self, [joIgnoreEmptyStrings, joIgnoreEmptyArrays, joDateIsUTC, joDateFormatISO8601]); which results in the Json string looking like { "HasDate":"2019-02-14T06:09:00.000Z", "NoDate":"1899-12-30T00:00:00.000Z", } while the ideal result would be { "HasDate":"2019-02-14T06:09:00.000Z", } Q:Is there a way to make TDateTime properties with a zero value be output as an empty string - and hence be stripped?
  18. Jacek Laskowski

    JSON string value

    Does Delphi have a function in RTL that will encode the text to a form consistent with the JSON value? For example, from string: "value\with {strange}chars/" to: "\"value\\with\r\n{strange}chars\/\"" It is possible?
  19. Hi, I cannot get this procedure TPerson.LoadSettings(const aJsonString: String). Is there any reason why self instance is not updated with new value ? Is their any workaround or should I create a LoadSettings method outside TPerson ? program Project1; {$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, REST.JSON, Unit1 in 'Unit1.pas'; var Person:TPerson; jsonstr:string; begin try Person:=TPerson.Create; try person.Name := 'Hello'; jsonstr:= Person.SaveSettings; writeln(jsonstr); //write {"name":"hello"} person.Name := 'hi'; Person.LoadSettings(jsonstr); writeln(person.Name); //write hi instead of Hello readln; finally Person.Free; end; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end. unit Unit1; interface type TPerson = class(TObject) private FName: string; public procedure LoadSettings(const aJsonString: String); function SaveSettings: string; property Name: string read FName write FName; end; implementation uses REST.JSON; procedure TPerson.LoadSettings(const aJsonString: String); begin self := TJSon.JsonToObject<TPerson>(aJsonString); end; function TPerson.SaveSettings: string; begin result := TJSon.ObjectToJsonString(self); end; end. Ps: I'm using Delphi RIO Updt 2
  20. Flavio Basile

    Firedac Json Reflection from XE7 to Rio

    Hi All; we have a big commercial project; It is coded with C++ Builder XE7. We have many Web Broker that after a call returns a dataset by Firedac Json Reflection. We would like to migrate our code from XE7 to Rio but we would like to know if there are difference between Json Reflection format of XE7 and Rio. There are also some important difference in Firedac between XE7 and Rio that we need to evaluate? Could we migrate our code without any important problems? Thanks, Flavio
  21. It is just a small addition to MARS Client library capabilities but TMARSClientResourceJSON now implements REST.Client.IRESTResponseJSON interface (from Delphi's REST Client library). This basically means you can use a TMARSClientResourceJSON and materialize a dataset through the TRESTResponseDataSetAdapter component (from Delphi's REST Client library). Enjoy 😉
  22. I have strange problem occurring when parsing a JSON string on iOS using the System.JSON library in Berlin. I call TJSONObject.ParseJSONValue() to get a value from the start of a JSON string which has worked fine if I run under Windows. As soon as I run under iOS, the same JSON string causes a null pointer exception. When debugging through, the null pointer is the TJSONObject class itself which is odd as ParseJSONValue() is a class function so don’t know why that would ever happen. I suspect this isn’t really the case and is just what the debugger is interpreting (the iOS debugger in Berlin isn’t great). I suspect the JSON string is too large for the parser as it’s a huge string. My question is whether anyone is aware of a size limit for parsing a JSON string or whether there’s a known issue in the Berlin JSON libraries which might cause this? Unfortunately I can’t provide a sample JSON string as it’s a client’s backup data but hopefully someone will be able to help.
×