views:

753

answers:

5

Are there any YAML parsers or YAML Serialization libs in Delphi?

+7  A: 

I don't know about a full YAML implementation, but JSON (a subset) is getting pretty popular and there are even some Delphi libraries listed on the JSON site. Delphi 2009 is even using (a slightly modified version of?) JSON in DataSnap.

http://sourceforge.net/projects/lkjson

http://www.progdigy.com/?page_id=6

http://sourceforge.net/projects/is-webstart/

Bruce McGee
I don't know much about inner working of DataSnap but the reason why I need YAML lib is because I am assigned a task to write a client software that communicates with a Server which is written in Python and this Server demands that all data exchange be done through YAML!If there is a lib available that would be great and I will be able to develop the client in Delphi or other wise I will have to spend a few sleepless nights Mastering Python.
Yogi Yang 007
+2  A: 

May be it is high time to implement a YAML parser in Delphi...

Copy code from PyYAML (but Python is a dynamically typed language)

Or take a look at SnakeYAML which is written in a statically typed language (Java)

A: 

Delphi's .dfm text format is very close to YAML (at least in versions 5/7). Could that not be tweaked abit more. Is the code in TPersistant?

May be it is high time to implement a YAML parser in Delphi...

Absolutely.

Nazar
DFM is only a reflection of compiletime published properties. So I think not. There are some special ways to create runtime additional properties, but that is not the normal use.
Marco van de Voort
+1  A: 

Free Pascal also has some json libs.

I garbled up something like this to interface with PHP once. Here is the code:

http://www.stack.nl/~marcov/phpser.zip

Note that it is more proof of concept than an usable lib.

Marco van de Voort
Thanks for this. I will look into this.
Yogi Yang 007
+1  A: 

This open source C# YAML parser looks like it could be a starting point for a Delphi implementation:

YamlDotNet - A .NET library for parsing and emitting YAML

mjustin
Thanks I will look this up also.
Yogi Yang 007