#!/usr/bin/env rexx
/* serialize.rex */
test = .array~new()

test~append(.directory~new())
test[test~last]['name'] = 'Adam'
test[test~last]['location'] = 'NC'
test[test~last]['terminated'] = .true
test[test~last]['number'] = 2
test[test~last]['description'] = 'The quick brown fox jumped over the lazy dog.'.endofline||'The quick brown fox jumped over the lazy dog.'

test~append(.directory~new())
test[test~last]['name'] = 'Bob'
test[test~last]['location'] = 'SC'
test[test~last]['terminated'] = .false
test[test~last]['number'] = 10
test[test~last]['description'] = .nil

test~append(.directory~new())
test[test~last]['name'] = 'Carl'
test[test~last]['location'] = 'VA'
test[test~last]['terminated'] = .false
test[test~last]['number'] = 15
test[test~last]['description'] = .nil

say .json~new()~toJSON(test)
Exit

::requires 'json.cls'