13

There appears to be a few JSON options for Delphi out there - is there a recommended library for use with XE2? I'm looking for sharing of objects between Delphi XE2 and PHP web applications. (serialization and posting delphi objects in a compatible way for PHP web apps and de-serialization from a restful PHP call to delphi server side)

Darian Miller
  • 7,808
  • 3
  • 43
  • 62

6 Answers6

11

JSON support* is included in XE2 (and XE). JSON

See this thread in SO for a link to a paper by Marco, explaining use of JSON and restful implementations.

REST Servers in Delphi XE Using DataSnap

  • Note : This is valid for the Enterprise and up version.
Community
  • 1
  • 1
LU RD
  • 34,438
  • 5
  • 88
  • 296
  • 4
    D2010 has DBXJSON included too, but it is severely broken (see [note](http://stackoverflow.com/questions/6217595/json-parse-result-from-virustotal-api/6218635#6218635)) – Premature Optimization Oct 12 '11 at 06:08
10

I know of two libraries.

The built in library and Super Object.

I use Super Object as it's really easy to use.

Martin Schneider
  • 14,263
  • 7
  • 55
  • 58
Robert Love
  • 12,447
  • 2
  • 48
  • 80
5

Unlike XML libraries (OmniXML, NativeXml) lkJSON does not provide methods to serialize TObject / TPersistent instances using RTTI directly, it requires custom code to map the property values to a JSON object.

SuperObject support marshaling for Delphi 2010 and higher.

mjn
  • 36,362
  • 28
  • 176
  • 378
5

DWScript has a dwsJSON unit which implements a fast JSON parser & writer, it doesn't rely on RTTI/TPersistent but on mapping by custom code.

Eric Grange
  • 5,931
  • 1
  • 39
  • 61
2

Open source delphi-oop library includes powerful serializer. It can use multiple backends (including native DBXJSON, superobject, NativeXml) and can serialize/deserialize almost anything. Some more information available in the project's wiki

Linas
  • 5,485
  • 1
  • 25
  • 35
2

Just for the record, there is one more JSON library, compatible with Delphi7+ and FPC.

It is side-project of mORMot and is speed-optimized (there were comparisons with SuperObject, though i don't recall the link)

Arioch 'The
  • 15,799
  • 35
  • 62