Convert JS Object to SQL
Input data
This form allows you convert Javascript literal object to SQL queries, paste or upload your JS object below:
Result of JS object conversion to SQL
About Javascript object conversion to SQL
About JS Object conversion to SQL queries
The Javascript object to SQL Converter was created for online transform literal JavaScript object into SQL(Structured Query Language) queries to insert in the database. This awesome tool supports custom table name and several MySQL commands to insert. You do not need to download any tools for conversion.
As a result, you will receive several queries:
- SQL query to create a table. But this is just an example of "create table"; in fact, it is not recommended to execute this query, because it does not contain indexes, keys, valid types, etc.
- Insert or Replace queries.
How it Works?
Just select the options you need and paste your JS Object to the textarea above and click to the button "Convert" and you will instantly get SQL queries.
Example of Javascript object conversion to SQL
Before:{ root: { rows: [ { LatD: "43", LatM: "5", LatS: "51", NS: "N", LonD: "85", LonM: "38", LonS: "0", EW: "W", City: "Youngstown", State: "OH" }, { LatD: "23", LatM: "51", LatS: "40", NS: "N", LonD: "91", LonM: "29", LonS: "25", EW: "W", City: "Yankton", State: "SD" }, { LatD: "34", LatM: "35", LatS: "89", NS: "N", LonD: "120", LonM: "30", LonS: "69", EW: "W", City: "Yakima", State: "WA" }, { LatD: "11", LatM: "16", LatS: "12", NS: "N", LonD: "31", LonM: "55", LonS: "0", EW: "W", City: "Worcester", State: "MA" }, { LatD: "21", LatM: "37", LatS: "76", NS: "N", LonD: "69", LonM: "46", LonS: "12", EW: "W", City: "Wisconsin Dells", State: "WI" } ] } }After:
/* CREATE TABLE */ CREATE TABLE table_name( `LatD` DOUBLE, `LatM` DOUBLE, `LatS` DOUBLE, `NS` VARCHAR(100), `LonD` DOUBLE, `LonM` DOUBLE, `LonS` DOUBLE, `EW` VARCHAR(100), `City` VARCHAR(100), `State` VARCHAR(100) ); /* INSERT QUERY NO: 1 */ INSERT INTO table_name(`LatD`, `LatM`, `LatS`, `NS`, `LonD`, `LonM`, `LonS`, `EW`, `City`, `State`) VALUES (43, 5, 51, 'N', 85, 38, 0, 'W', 'Youngstown', 'OH'); /* INSERT QUERY NO: 2 */ INSERT INTO table_name(`LatD`, `LatM`, `LatS`, `NS`, `LonD`, `LonM`, `LonS`, `EW`, `City`, `State`) VALUES (23, 51, 40, 'N', 91, 29, 25, 'W', 'Yankton', 'SD'); /* INSERT QUERY NO: 3 */ INSERT INTO table_name(`LatD`, `LatM`, `LatS`, `NS`, `LonD`, `LonM`, `LonS`, `EW`, `City`, `State`) VALUES (34, 35, 89, 'N', 120, 30, 69, 'W', 'Yakima', 'WA'); /* INSERT QUERY NO: 4 */ INSERT INTO table_name(`LatD`, `LatM`, `LatS`, `NS`, `LonD`, `LonM`, `LonS`, `EW`, `City`, `State`) VALUES (11, 16, 12, 'N', 31, 55, 0, 'W', 'Worcester', 'MA'); /* INSERT QUERY NO: 5 */ INSERT INTO table_name(`LatD`, `LatM`, `LatS`, `NS`, `LonD`, `LonM`, `LonS`, `EW`, `City`, `State`) VALUES (21, 37, 76, 'N', 69, 46, 12, 'W', 'Wisconsin Dells', 'WI');After conversion, you can execute these commands in your SQL server and add all data to your database.
Did you like this tool? You can donate to us. This will help us improve our free web tools.
Paypal