set output to output & "{"
set output to output & "\"id\": \"" & (get id of todolist) & "\", "
set output to output & "\"name\": \"" & (get name of todolist) & "\", "
set output to output & "\"todos\": ["
repeat with j from 1 to length of todos
set todo to item j of todos
set title to replace_chars(name of todo, "\"", "\\\"") of me
set output to output & "{"
set output to output & "\"id\": \"" & (get id of todo) & "\","
set output to output & "\"title\": \"" & title & "\","
set output to output & "\"body\": " & null_or_string(body of todo) of me & ","
set output to output & "\"priority\": " & (get priority of todo) & ","
set output to output & "\"completed\": " & (get completed of todo) & ","
set output to output & "\"created_at\": " & null_or_datetime(creation date of todo) of me & ","
set output to output & "\"updated_at\": " & null_or_datetime(modification date of todo) of me & ","
set output to output & "\"completed_at\": " & null_or_datetime(completion date of todo) of me & ","
set output to output & "\"due_date\": " & null_or_datetime(due date of todo) of me & ","
set output to output & "\"remind_date\": " & null_or_datetime(remind me date of todo) of me
set output to output & "}"