try { sql connect "session1" {cm get "demo_cm_mysql";}; json load "keyId" (file load "data/file.json";); json parse_array "keyId" "/" "obj" { #without [] obj is loaded automaticaly; -> "[A]" (json select "obj" "/A"); -> "[B]" (json select "obj" "/B"); -> "[C]" (json select "obj" "/C"); sql dml "session1" (concat "insert into products (id, name, quantity) values (" (sql encode [A]) ", " (sql encode [B]) ", " (sql encode [C]) ");"); }; sql disconnect "session1"; } { try {sql disconnect "session1";} {} "[err]"; } "[err]";
try { sql connect "session1" {cm get "demo_cm_mysql";}; json load "keyId" (file load "data/file.json";); json parse_array "keyId" "/" "[row]" { #with [] you must load obj; json load "obj" [row]; -> "[A]" (json select "obj" "/A"); -> "[B]" (json select "obj" "/B"); -> "[C]" (json select "obj" "/C"); sql dml "session1" (concat "insert into products (id, name, quantity) values (" (sql encode [A]) ", " (sql encode [B]) ", " (sql encode [C]) ");"); }; sql disconnect "session1"; } { try {sql disconnect "session1";} {} "[err]"; } "[err]";