lastInsertID.LAST_INSERT_ID() did not work due to residual parentheses from the SQL command. The solution was to use
In another case, the result of an EXISTS query returned a JSON object with dynamically changing parameters. To retrieve the value of the first key of the first JSON object returned, the solution was to use
Both solutions were found through helpful advice and collaboration with Amelia.