diff --git a/README.md b/README.md index 2c112b4..a79fffa 100644 --- a/README.md +++ b/README.md @@ -148,3 +148,13 @@ Here are some drafts being under development and not fully tested, any bugs dete ### JSON To XML DOM converter [JSON2XML.bas](https://github.com/omegastripes/VBA-JSON-parser/blob/master/Beta/JSON2XML.bas). Converting JSON string to XML string and loading it into XML DOM (instead of building a structure of dictionaries and arrays) can significantly increase performance for large data sets. Further XML DOM data processing is not yet covered within current version, and can be implemented via DOM methods and XPath. + +### Douglas Crockford json2.js implementation for VBA + +**jsJsonParser** parser is essential for parsing large amounts of JSON data in VBA, it promplty parses strings up to 10 MB and even larger. This implementation built on [douglascrockford/JSON-js](https://github.com/douglascrockford/JSON-js/blob/master/json2.js), native JS code runs on IE JScript engine hosted by htmlfile ActiveX. Parser is wrapped into class module to make it possible to instantiate htmlfile object and create environment for JS execution in Class_Initialize event prior to parsing methods call. + +There are two methods available to parse JSON string: `parseToJs(sample, success)` and `parseToVb sample, jsJsonData, result, success`, as follows from the names you can parse to native JS entities of JScriptTypeInfo type, or parse to VBA entities which are a structure of nested Dictionaries and Arrays as described in [Purpose and Features](https://github.com/omegastripes/VBA-JSON-parser#purpose-and-features) section. Access to native JS entities is possible using `jsGetProp()` and `jsGetType()` methods. For JS entities processing you have to have at least common knowledge of JavaScript Objects and Arrays. + +Also you can parse to JS entities first, then make some processing and finally convert to VBA entities by calling `parseToVb , jsJsonData, result, success` for further utilization. JS entities can be serialized to JSON string by `stringify(jsJsonData, spacer)` method, if you need to serialize VBA entities, then use `JSON.Serialize()` function from [JSON.bas module](https://github.com/omegastripes/VBA-JSON-parser/blob/master/JSON.bas). If you don't want to mess with JS entities, simply use `parseToVb sample, , result, success` method. Note that convertion to VBA entities will take extra time. + +Some examples are in jsJsonParser_v0.1.1.xlsm of [v1.7.21 release](https://github.com/omegastripes/VBA-JSON-parser/tree/v1.7.21)