Last active
August 29, 2018 16:00
-
-
Save osoda/fd61c7854ff34446b26ec00ed4117d76 to your computer and use it in GitHub Desktop.
Transform the result select sql that show the GUI (MySQL Workbench)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.SelectToJSON = function(){ | |
var str = '['+this.split('\n').map((el)=>{return '{'+el.split(', '). | |
map((e,i)=>{return `"${i}": ${e.replace(/'/gi, '"')}`})+'},'}).join('\n').slice(0,-1)+']' | |
return JSON.parse(str) | |
} | |
// Result shown by Gui And Copy whit the option 'Copy Row' | |
var result = `'6', 'PAULA ', '2018-01-30', ' KEVIN', '', '0', '', '', 'SASA1', '2' | |
'7', 'BRANDON ', '2018-01-30', 'ALBLO', '', '0', '', '', 'SASA1', '3' | |
'8', 'PILAR', '2018-01-30', 'CACERES', '', '0', '', '', 'SASA1', '4'` | |
objJson = result.SelectToJSON() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment