JsonWriter.ValueVariantmethod
Serializes a `DVARIANT` using JSON‑compatible mapping.
Syntax
SUB ValueVariant (BYREF dv AS DVARIANT)
Parameters
| Name | Description | |
|---|---|---|
dv | A variant value. |
Description
Serializes a DVARIANT using JSON‑compatible mapping.
Mapping :
- Empty/Null: null
- Boolean: true/false
- BSTR: string (escaped)
- R4/R8: number (double)
- Integral types (signed/unsigned): number (integer)
- Arrays (common VT_ARRAY types): delegates to ValueSafeArray
- Other: dv.ToStr() as string fallback
Example
#include once "AfxNova/AfxJson.inc" USING AfxNova
DIM jw AS JsonWriter jw.SetIndentSize(0) ' 0 = no pretty-print jw.BeginObject() jw.Name("k") : jw.Value("v") jw.Name("n") : jw.Value(123) jw.Name("b") : jw.ValueVariant(DVARIANT(FALSE, "BOOLEAN")) jw.Name("nil"): jw.ValueVariant(DVARIANT()) jw.EndObject() print jw.ToBString
Reference
- Defined in AfxNova/AfxJson.inc:593
- Documented in WebView/Json Classes.md
- Topic: JSON Reader and Writer classes