Unable to convert certain keywords in record to JSON
data and id are both keywords within the AppleScript language.

It may be possible to quote these words to avoid their being interpreted as special cases. Try using the pipe character or double angle brackets/chevrons to wrap these keys.