set json to json & tab2 & "\"mods\": {" & return
set m to theMods of r
if not q_is_empty(cmd of m) then
set json to json & tab3 & "\"cmd\": {" & return
set json to json & tab4 & "\"valid\": \"" & my encode(isValid of cmd of m) & "\"," & return
set json to json & tab4 & "\"arg\": \"" & my encode(theArg of cmd of m) & "\"," & return
set json to json & tab4 & "\"subtitle\": \"" & my encode(theSubtitle of cmd of m) & "\"" & return
set json to json & tab3 & "}," & return