damn typos...

Changed the test for JSON array versus JSON object.
Let the loop for bulk insert an array run within the context of an transaction for better performance.