Опитайте да подадете само низа от { до } без предходните редове.
on mouseUp
set the hideConsoleWindows to true
put shell("C:\mongodb\bin\mongo.exe --eval" && \
quote & "printjson(db.test.findOne())" & quote) into pJSON
put pJSON into fld "a"
put JSONToArray(line 3 to -1 of pJSON) into tArray // <-- this line changed
put tArray["a"] into fld "B"
end mouseUp