set mainJsonBuilder to sb's new("{")
repeat with i from 1 to count of keyList
if i is not 1 then
mainJsonBuilder's append(", ")
end if
set nextKey to item i of keyList
set nextValue to getValue(nextKey)
set end of nameValueList to nextKey
set end of nameValueList to nextValue
mainJsonBuilder's append("\"" & nextKey & "\": ")
if nextValue is missing value then
mainJsonBuilder's append("null")
else if {integer, real, boolean} contains class of nextValue then