Dim json As Map
json.Initialize
json.Put("name","John")
json.Put("age",30)
'
' Cars needs a list first
Dim cars As List
cars.Initialize
Dim ford As Map
ford.Initialize
ford.Put("name","Ford")
Dim models As List
models.Initialize
models.AddAll(Array As String("Fiesta", "Focus","Mustang"))
ford.Put("models",models)
cars.Add(ford)
Dim bmw As Map
bmw.Initialize
bmw.Put("name","BMW")
Dim models As List
models.Initialize
models.AddAll(Array As String("320", "X3","X5"))
bmw.Put("models",models)
cars.Add(bmw)
Dim fiat As Map
fiat.Initialize
fiat.Put("name","Fiat")
Dim models As List
models.Initialize
models.AddAll(Array As String("500", "Panda"))
bmw.Put("models",models)
cars.Add(fiat)
json.Put("cars",cars)
Dim jgen As JSONGenerator
jgen.Initialize(json)
Log(jgen.ToPrettyString(2))
Log(jgen.ToString)