How to parse a JSON string in Delphi?

You don’t need to use external libraries to perform a JSONPath search. Example with Delphi 10 Seattle: uses System.JSON; procedure ParseJSonValue; var JSonValue:TJSonValue; st:string; Branch: string; begin st := ‘{“data”:{“results”:[{“Branch”:”ACCT590003″}]}}’; JsonValue := TJSonObject.ParseJSONValue(st); Branch := JsonValue.GetValue<string>(‘data.results[0].Branch’); JsonValue.Free; end;

Which language elements can be annotated using attributes language feature of Delphi?

Interesting question! You can declare attributes on almost anything, the problem is retrieving them using RTTI. Here’s a quick console demo of declaring custom attributes for: Enums Function type Procedure type Method type (of object) Aliased type Record type Class type Record type that’s internal to a class Record field Record method Class instance field … Read more

What is TMonitor in Delphi System unit good for?

TMonitor combines the notion of a critical section (or a simple mutex) along with a condition variable. You can read about what a “monitor” is here: http://en.wikipedia.org/wiki/Monitor_%28synchronization%29 Any place you would use a critical section, you can use a monitor. Instead of declaring a TCriticalSection, you can simple create a TObject instance and then use … Read more

How hard is it to migrate a project from Delphi 7 to Delphi XE?

The only real problem is conversion to Unicode. You should learn how Unicode support is implemented in Delphi – start from Marco Cantu White Paper: Delphi and Unicode It is impossible to estimate the amount of work required to upgrade old applications to Unicode without knowing the actual code. If you were using string types … Read more

Delphi: why breakpoints from time to time are not usable (green highlighted line on IDE)?

Debug info isn’t present in the file. Make sure that you’re using the Debug configuration. (Project Manager tree, expand Build Configurations, make sure Debug is bold. If it’s not, right click Debug and choose Activate from the context menu.) Make sure you then do a Build of your project, not just a Compile. If that … Read more

SOAP server and client application VCL+indy demo for Delphi XE?

I have posted the complete set of demos for SOAP on CodeCentral as item 28789. These contain every single one of the Delphi 2007 era SOAP demos from the WebServices folder, now updated for Delphi XE and XE2, including converting the old WAD servers into new INDY VCL servers. You’d think that was impressive, except … Read more