PRO 69 Posted June 2, 2017 Report Share Posted June 2, 2017 Hi there, does anyone know if there is any existing plugin that enables to convert UBot table data into JSON? Similar to this: http://www.developerdan.com/table-to-json/ Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted June 2, 2017 Report Share Posted June 2, 2017 You can do this with python. Depends on which context tho.Weather you are getting this from file or scraping and do you want a JSON file. Please give more details.Nick Quote Link to post Share on other sites
PRO 69 Posted June 2, 2017 Author Report Share Posted June 2, 2017 You can do this with python. Depends on which context tho. Weather you are getting this from file or scraping and do you want a JSON file. Please give more details. Nick Hi Dr. Nick ;-) I have the tabular data inside UBot &table. The UBot &table is the medium of choice (I load data from files, scraping and previous processes into it). I am searching for a best solution how I can JSON stringify from &table. As the example given in initial post above, I would like to do such inside of UBot itself (if possible in a "native" way, without JS or Python, to keep it straight). But if it is not possible or feasible, Python or JS may be required for just that conversion. I am open for any good way. Thanks & Greetings Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted June 2, 2017 Report Share Posted June 2, 2017 Hi, Why do you need it in JSON? Are you gonna use it as a database or for submission?JSON is just a python dictionary you can use "json" python module to "load" from file or "dump" it to file.https://docs.python.org/2/library/json.htmlRegards,NIck Quote Link to post Share on other sites
PRO 69 Posted June 2, 2017 Author Report Share Posted June 2, 2017 Hi Nick, I would need it mainly for submission. But it should be working out of the box in compiled bots, so I try to avoid using python, in this case. Thanks & Greetings Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted June 2, 2017 Report Share Posted June 2, 2017 Hi Nick, I would need it mainly for submission. But it should be working out of the box in compiled bots, so I try to avoid using python, in this case. Thanks & GreetingsHave you reported your findings to the tracker? iron python in ubot not working compiled is news to me... What UBot version are you using? http://tracker.ubotstudio.com/ Quote Link to post Share on other sites
PRO 69 Posted June 2, 2017 Author Report Share Posted June 2, 2017 I did not report anything, cause I did not try anything, yet :-) It was my assumption, that the clients which use compiled bots would need to install additional software packages (Python), in order to get the compiled bots to excecute. I never worked with UBot and Python in conjunction. I worked with CPython 3.x stand alone, but I guess that's a whole different story, not sure. Do you think you have a solution, how to convert &table to JSON (Javascript Object)? Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted June 2, 2017 Report Share Posted June 2, 2017 iron python is part of the "support files" and comes with a subset of the standard libraries only the pure python packages/modules. I prefer to use the "Execute Python" plugin from TJ which is now free. When ever possible. However, "json" is included with iron python(ubot's python). googlecsv to json python Quote Link to post Share on other sites
PRO 69 Posted June 2, 2017 Author Report Share Posted June 2, 2017 Thanks for the explainaition and hints, did't know that. I can google it up the whole day, however I basically search the shortest way from UBot &table to JSON (I plan to use it extensively, so I want to avoid the extra file system step with CSV). Just want to be able to convert UBot &table data(at runtime) to JSON string. The JSON string should be also accesible by UBot after the conversion. Ubot raw &table data to Ubot variable (including the generated JSON string). Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted June 2, 2017 Report Share Posted June 2, 2017 if the &table is the same data why notread from file both? Quote Link to post Share on other sites
PRO 69 Posted June 2, 2017 Author Report Share Posted June 2, 2017 I can not understand what you are trying to tell me :-)My only problem is, how can I converst date of a UBot &table into an JavaScript Object (JSON String), the string should be a UBot #variable.I want to do this extensively on a changing dataset, so I look for a solution which works inside UBot without need of temporary external files..Similar function like here: http://www.developerdan.com/table-to-json/ (press convert)They use HMTL table as input, I want to use UBot &table as the input.They do the conversion with help of JavaScript, I would prefer to do it "natively" inside Ubot.They output the string as an Alert, I want to output the string as an UBot #variable. Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted June 2, 2017 Report Share Posted June 2, 2017 I thought the data in &table is from a file on your hard drive. I spent too much time on this. I hope someone else can help you. Regards,Nick Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted June 2, 2017 Report Share Posted June 2, 2017 it is easier to read in the same file(csv) you are reading into your &table, into JSON string. In other words converting the ubot table to a JSON string is a ton more code. So, what I am asking is why not just read from the file into JSON string directly? Anyways, I am done. Good luck. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.