Recent

Author Topic: ANN: IDocList/IDocDict JSON for Delphi and FPC  (Read 1511 times)

abouchez

  • Full Member
  • ***
  • Posts: 120
    • Synopse
ANN: IDocList/IDocDict JSON for Delphi and FPC
« on: February 02, 2024, 06:17:46 pm »
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, including several enumerators for ranges or searching.

Two one-liners may show how our mORMot library is quite unique in the forest/jungle of JSON libraries for FPC (and Delphi):

Code: Pascal  [Select][+][-]
  1. assert(DocList('[{ab:1,cd:{ef:"two"}}]')[0].cd.ef = 'two');
  2. assert(DocList('[{ab:1,cd:{ef:"two"}}]').First('ab<>0').cd.ef = 'two');
Yes, this code compiles and run on FPC.  :D

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. The fastest for FPC for sure.

More info:
https://blog.synopse.info/?post/2024/02/01/Easy-JSON-with-Delphi-and-FPC
 ;D

Okoba

  • Hero Member
  • *****
  • Posts: 572
Re: ANN: IDocList/IDocDict JSON for Delphi and FPC
« Reply #1 on: February 02, 2024, 06:24:43 pm »
Very cool and useful, and I bet it is fast as always.
Thanks ab!
I'm going to test it now.

PS. Your blog needs a code highlighter to appreciate this beauty. BTW And I didn't know you like music.
« Last Edit: February 02, 2024, 06:36:13 pm by Okoba »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8783
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: ANN: IDocList/IDocDict JSON for Delphi and FPC
« Reply #2 on: February 15, 2024, 02:21:43 pm »
Interesting to know interfaces are that dynamic.

 

TinyPortal © 2005-2018