I am looking for a library enabling me to serialize/deserialize plain Delphi objects (podos) from and to JSON. Some of my requirements:

I am looking for a library enabling me to serialize/deserialize plain Delphi objects (podos) from and to JSON. Some of my requirements:

- Fast: I am going to use this library to build RESTful services.
- Configurable through annotations of Delphi classes in order to control the generated JSON.
- Automatic mapping (deserialization) of JSON to the corresponding Delphi class.
- Support for all standard JSON types.

Comments

  1. Ugochukwu Mmaduekwe It can no longer be trusted, and it has been that way for a quite a while. If I remember correctly, it started with SizeOf having issues.

    ReplyDelete
  2. A. Bouchez Thanks for the feedback. I am currently looking into JsonDataObjects because the dependencies are minimal (in other words one single unit in this case). I was thinking of implementing a mapper class, which would automatically create a TJsonObject from a PODO using RTTI (and then call TJsonObject.ToJson()) to generate the actual JSON. Would using RTTI in such a way introduce a big performance hit?

    ReplyDelete
  3. Don't reinvent the wheel: your serializer will be slower then JsonDataObjects, for sure. TJsonObject.FromSimpleObject method is what you expect: create a TJsonObject from an instance.
    Anyway, generating the JSON via a temporary TJsonObject will be slower, for sure, than direct serialization, as we do in mORMot's ObjectToJson(), which calls TJSONSerializer.WriteObject directly.
    Make actual profiling on yourapplication: I guess the JSON won't be the bottleneck, with JsonDataObjects.

    ReplyDelete

Post a Comment