Vincent Parrett 879 Posted September 3 Hi All I have released a new YAML Parser/Emitter library for Delphi XE2 or later. It is pure delphi code, tested with Win32 and Win64 but it should work for other platforms too (no winapi dependencies). Supports YAML 1.1 (partially) & 1.2 JSONPath queries with filter expressions Multiple Document streams. https://github.com/VSoftTechnologies/VSoft.YAML 11 3 Share this post Link to post
Stefan Glienke 2169 Posted September 3 You are missing passing TFormatSettings to the StrTo... functions that you are calling - that makes it fail on systems that use a comma as a decimal separator, for example. 2 Share this post Link to post
Vincent Parrett 879 Posted September 3 Thx, I missed a few places - changes pushed! Share this post Link to post
Vincent Parrett 879 Posted September 3 With a few missing TFormatSettings fix - it now works on different locales - and is tested on Linux (2 tests failing due to file path issues in the tests). It should work on OSX and mobile but I haven't tested that. 1 1 Share this post Link to post
SteCam 0 Posted September 5 On initial install this looks really good. I have been using Neslib.Yaml up till now but look forward to seeing how this compares. The backwards compatibility is a plus - Neslib.Yaml requires Delphi 10.4 or higher. Share this post Link to post
mvanrijnen 130 Posted September 5 Nice work, maybe a good base for upgrading our config files to YAML, Share this post Link to post
Vincent Parrett 879 Posted September 6 11 hours ago, mvanrijnen said: Nice work, maybe a good base for upgrading our config files to YAML, Thanks. What format are you using for your config files now? If it's JSON, the parser should be able to load them - since YAML 1.2 is a superset of JSON - I added some unit tests and fixed one small bug with whitespace handling today. Share this post Link to post
Kas Ob. 156 Posted September 6 RealThinClient has very powerful TRtcInfo, it is simply put magnificent, capable of many things, but few things in particular are most powerful, namely the ability to read from XML, XML-RPC, JSON and its own binary compacted format also the ability write to any. https://github.com/teppicom/RealThinClient-SDK/blob/develop/src/Lib/rtcInfo.pas#L4073-L4146 YAML is beauty, and having the ability to convert to/from JSON would be fantastic feature, so this might be feature suggestion. Share this post Link to post
Vincent Parrett 879 Posted September 6 Converting to JSON would be case of adding a new writer class that can write the yaml classes out - wouldn't be difficult. I will look at it when I have time. 2 Share this post Link to post
mvanrijnen 130 Posted September 6 (edited) 7 hours ago, Vincent Parrett said: Thanks. What format are you using for your config files now? If it's JSON, the parser should be able to load them - since YAML 1.2 is a superset of JSON - I added some unit tests and fixed one small bug with whitespace handling today. mostly good old init style like files, one service an xml as config file, but most ini style like. we got our own config readers for this wich works with attribute decorating, busy with some new things, gonna pick this up with yaml. It's always a bit of puzzle with "nesting" with the ini style like configs. Edited September 6 by mvanrijnen Share this post Link to post
pyscripter 833 Posted September 6 (edited) Nice job. It would be great, if there was also a serialization layer. For instance you have a config object and you save it to a YAML file with a single command. You then deserialize it and use it directly without having to query the YAML document. See for instance pyscripter/toml-delphi: Toml parser and writer for Pascal and Delphi. Edited September 6 by pyscripter Share this post Link to post
Vincent Parrett 879 Posted September 6 1 minute ago, pyscripter said: It would be great, if there was also a serialization layer. I considered it - I did look at what you did with your toml parser - but I have a requirement to work with XE2+ and the system.json unit has various bugs that I did not want to fight with each version of delphi I support. Share this post Link to post
pyscripter 833 Posted September 6 (edited) 6 minutes ago, Vincent Parrett said: but I have a requirement to work with XE2+ and the system.json unit has various bugs I understand. Json serialization (System.JSON.Serializer) became reliable only with Delphi 11 and later. I think it was introduced in Delphi 10.4. Edited September 6 by pyscripter Share this post Link to post
Vincent Parrett 879 Posted September 7 20 hours ago, Kas Ob. said: AML is beauty, and having the ability to convert to/from JSON would be fantastic feature, so this might be feature suggestion. Done. Adding JSON writing was pretty trivial. 3 Share this post Link to post
pyscripter 833 Posted September 7 3 hours ago, Vincent Parrett said: Done. Adding JSON writing was pretty trivial. With JSON writing/reading, adding serialization for Delphi 10.4+ should be trivial. Share this post Link to post
Kas Ob. 156 Posted September 7 3 hours ago, Vincent Parrett said: Done. Adding JSON writing was pretty trivial. Nice ! Not seeing reader or i am missing something ? With reader from JSON, this library will become a must-have tool simplifying JSON debug handling, YAML is human reading friendly, so can be used where JSON usually used also replacing INI and config files. Share this post Link to post
Vincent Parrett 879 Posted September 7 7 minutes ago, Kas Ob. said: Not seeing reader or i am missing something ? You don't need anything special to read json - just call TYAML.LoadFromXXX 1 Share this post Link to post
Vincent Parrett 879 Posted September 7 16 minutes ago, pyscripter said: With JSON writing/reading, adding serialization for Delphi 10.4+ should be trivial. I would probably do that as a separate library - it's certainly doable. 1 Share this post Link to post
Kas Ob. 156 Posted September 7 33 minutes ago, Vincent Parrett said: You don't need anything special to read json - just call TYAML.LoadFromXXX Yes i was hasty to not consider the generic way to load, nice! 1 Share this post Link to post
Vincent Parrett 879 Posted September 7 Nice - I do need to add some sample apps at some point - this would be a good one! Share this post Link to post
Lars Fosdal 1904 Posted September 7 Very nice. Now we just need an OpenAPI 3.0 to Delphi REST code implementation 🙂 Share this post Link to post