Visual Basic 6.0
Visual Basic 6.0
Example: JsonObject.NewObjectOf method
Demonstrates theNewObjectOf method.
Chilkat Visual Basic 6.0 Downloads
Dim success As Long
success = 0
Dim car As String
car = "{""make"":""Toyota"",""model"":""Camry"",""year"":2022,""color"":""silver"",""engine"":{""type"":""inline-4"",""fuel"":""gasoline"",""horsepower"":203},""features"":[""bluetooth"",""backup camera"",""adaptive cruise control"",""lane assist""],""isElectric"":false}"
Dim json As New ChilkatJsonObject
success = json.UpdateString("test","abc")
success = json.NewObjectOf("car",car)
If (success = 0) Then
Debug.Print json.LastErrorText
Exit Sub
End If
json.EmitCompact = 0
Debug.Print json.Emit()
' Result:
' {
' "test": "abc",
' "car": {
' "make": "Toyota",
' "model": "Camry",
' "year": 2022,
' "color": "silver",
' "engine": {
' "type": "inline-4",
' "fuel": "gasoline",
' "horsepower": 203
' },
' "features": [
' "bluetooth",
' "backup camera",
' "adaptive cruise control",
' "lane assist"
' ],
' "isElectric": false
' }
' }