Http://blog.marcocantu.com/blog/json_libraries_delphi_rest.html
If you want to take advantage of jquery and some of its plug-ins in a Delphi Xe datasnap rest server application, you shoshould Replace the JSON processing library.
I 've been working a lot with Delphi Xe's datasnap rest server projects. I prepared a White Paper for Embarcadero, and some introductory videos, and will host a webinar for the company in a couple of weeks (details shoshould be made available soon ). i'm also
Developing a couple of real world projects and building an add-in Library (to be called "Delphi rest plus" or "dwarf, delphi web application rest framework "or SOE other name I still have to figure out ...). but that's for another post. before I get to
Actual topic, let me underline I like this new Delphi Xe architecture a lot, but it is only a good foundation you have to build more on top.
So, getting to this specific post, if you want to take advantage of jquery and some of its plug-ins in a Delphi datasxe rest server application, you shoshould Replace the JSON processing library that Embarcadero picked and that is causing lots of incompatibilities.
That is the json-min.js file, an open source library by Brenton Fletcher. The specific issues I 've had was with the "jquery validation plug-in 1.7" (http://bassistance.de/jquery-plugins/jquery-plugin-validation ).
As a replacer, I picked the "most official" javascript Parser for JSON, the public domain json2.js library you can find
Http://www.JSON.org/json2.js and see the description
Http://www.JSON.org/js.html. Now, of course, I also had to fix the some of the other JavaScript files generated by the datasnap rest Application Wizard in Delphi Xe. I don't think I can provide the actual
Files (since they are proprietary), only list the changes.
InServerfunctionsexecutor. jsYou have to change (around line 150) the first line below with the second:
contentParam = contentParam.toJSONString(); // original contentParam = JSON.stringify(contentParam); // new
And (around line 180) You have to fix:
JSONResultWrapper = responseText.parseJSON(); // original JSONResultWrapper = JSON.parse (responseText); // new
The first change (JSON. stringifyForTojsonstring) Has to be done also in the serverfunctionsinvoker. js file.
That's all for now, but stay tuned for other fixes and improvements to Delphi's rest support... and for the Embarcadero webinar.
PS. Still two more days only for the extra discount for delphi developer days Europe:
Http://www.delphideveloperdays.com /.