I've got a rapid development tool for an ERP-system, which allows only vbscript. I'm trying to create a simple AJAX-Request with VBS. That worked with the "Microsoft.XMLHTTP"-object.
Next step is to receive data from a webserver using json. But in VBS there seems to be no function like "json_decode" oder other.
Does anyone know a solution? Or is the only option to develop my own json-function?
As JSON is a hierarchical data format, using Regular expressions and Split(), as Peter proposed, won't get you far.
If your environment allows CreateObject()
you may be able to use a ready made COMponent written in another language (e.g. wrap the standard json2.js in a .WSC or COM enable a .NET DLL). Another option would be to harness another language via the Microsoft Script Control. The con of this approach is that you'll have to deal with the objects/arrays delivered by the other language (some hints are to be found in the topic Peter refered to).
A pure VBScript solution can be found here. I can't read the documentation, but the code compiles and 'works' for simple test cases - YMMV.
How about doing this with ASPJSON?
Available from http://www.aspjson.com/
I'm about to use this as a solution for a very old site to send an ajax call (using Jquery) with the encoded data to a MongoDB, for testing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With