Jump to content
UBot Underground

How To Tell How Many Objects In Json Data File


Recommended Posts

---solved

not normaly working with json it did not occur to that every line has a distinct id number.

list to list/

all items with element = id/

list total

 

i want to load json data into a table.

how do i determine how many objects in a file?

Link to post
Share on other sites

You can load a .json file into python.
JSON and a python dictionary are pretty much the same.

 

You can dump a python dictionary into a .json file too.

Send JSON  as well.

 

You can use the "json" module, it comes with ubot's python.
 

google "json python 2"

Link to post
Share on other sites

you would also want to look up

python dictionary

as well

save to file("{$special folder("Desktop")}\\test-json.json","\{
  \"args\": \{\}, 
  \"headers\": \{
    \"Accept\": \"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\", 
    \"Accept-Encoding\": \"gzip, deflate\", 
    \"Accept-Language\": \"en-US,en;q=0.8\", 
    \"Cookie\": \"_ga=GA1.2.763621291.1481916579; _gat=1\", 
    \"Host\": \"httpbin.org\", 
    \"Referer\": \"http://httpbin.org/\", 
    \"Upgrade-Insecure-Requests\": \"1\", 
    \"User-Agent\": \"Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36\"
  \}, 
  \"origin\": \"111.222.111.00\", 
  \"url\": \"http://httpbin.org/get\"
\}")
python("","import json

jfile = r\"{$special folder("Desktop")}\\test-json.json\"

with open(jfile, \'r\') as jf:
    jread = jf.read()
    
jdict = json.loads(jread)")
alert($python result("","len(jdict)"))

This is kinda what it may look like.

depends on a lot of things

 

CD

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