dwsJSON is a unit that supports JSON parsing/creating, it’s part of DWScript but relatively “standalone”, in that if you add it in your Delphi (or FPC) projects, it won’t pull the whole of DWScript library, and thus can be used anywhere you need.
The JSON parser in dwsJSON generates an object tree based on TdwsJSONValue (and its subclasses), you can also create such a tree from scratch and use it to spit out JSON. There is also a low-level JSON writer for fast, write-only streaming. All classes support full Unicode (in Delphi) as well as very long strings (like a base64 streamed image).
After looking at String concatenation and String Building in Delphi, and as a conclusion, it’s time to have a brief look at what happens in multi-threaded settings, such as in a server pushing JSON, XML or some other text data.
The DWS Web Server pre-compiled binary has been updated, it is now packaged in an InnoSetup installer, comes with SQLite 220.127.116.11 and other changes (see below).
The installer is still rather simple, but includes command files for service installataion/uninstallation, link to online documentations and an uninstaller. The previous Getting Started guide still applies, but is thus simplified.
I’ve now been running the DWScript Sample Web Server for 8 months in a metered host (Ikoula’s 1€/month VM), so it’s time for a more formal introduction article.
It served web pages and JSON dynamically generated by DWScript, using an SQLite database for storage. It ran on a Windows 2008 R2 Standard installation, minimized so that OS+Server stayed around 256 MB RAM.
Here is a summary of DWScript changes since the last update.
Language enhancement are centered around several additions for enumeration elements and sets, as well as a standard Map() method for arrays. The JIT compiler also got more capable, and there were various improvements to the support libraries and compatibility with older (D2009) and newer (DXE3) Delphi versions.