%REM The following code is abbreviated code from ComplexPersonTest. It creates a JsonConversionHelper to convert "name" and "type" properties as scalars and passes it to a JsonBasicObjectArrayConverter. Unlike the JsonBasicObjectConverter example, this converts a Variant array of pets. The population of the Person object is omitted here, but it is generated from the following JSON {"firstName":"Paul","lastName":"Withers","pets": [{"name":"Peter","type":"Guinea Pig"},{"name":"Benjamin","type":"Guinea Pig"}]} %END REM Dim helper as New JsonConversionHelper() Dim petConverter as New JsonBasicObjectConverter("Pet", "ComplexPersonTest") Dim person as Person Dim jsonObj as JsonObject Dim petHelper as New JsonConversionHelper() Call helper.withScalarConverter("name").withScalarConverter("type") Call petConverter.withHelper(petHelper.withScalarConverter("name").withScalarConverter("type")) Call helper.withCustomConverter("pets", petConverter) Set jsonObj = helper.toJson(person) |