Jump to content
UBot Underground

Convert Ubot Table Data To Json


Recommended Posts

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

Link to post
Share on other sites

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.html

Regards,
NIck

Link to post
Share on other sites

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

Link to post
Share on other sites

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

Have 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/

Link to post
Share on other sites

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)?

Link to post
Share on other sites

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). :)

google

csv to json python

Link to post
Share on other sites

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).

Link to post
Share on other sites

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.
Link to post
Share on other sites

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. :)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...