Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple Python Json Help
#1
Hi, I'm trying to use python to grab the "memberCount" value of this page
https://groups.roblox.com/v1/groups/42

Can someone help out? Should be pretty simple.
Reply
#2
What have you tried so far?
It is very simple using the json module (json.loads()).
Reply
#3
I know how to do basic json parsing but not when it's like this

{"id":42,"name":"Building","description":"Building, the cornerstone of Roblox.","owner":{"userId":80119,"username":"stravant","buildersClubMembershipType":3},"shout":null,"memberCount":542727}

I'm not too advanced so if anyone can help that would be appreciated. I tried simple ["id"]["memberCount"] stuff
Reply
#4
import json

myInput = '{"id":42,"name":"Building","description":"Building, the cornerstone of Roblox.","owner":{"userId":80119,"username":"stravant","buildersClubMembershipType":3},"shout":null,"memberCount":542727}'

j = json.loads(myInput)
print(json.dumps(j, indent=4, sort_keys=True))
print('MemberCount: {}'.format(j['memberCount']))
Reply
#5
Worked, thank you.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python Split json into separate json based on node value CzarR 1 5,476 Jul-08-2022, 07:55 PM
Last Post: Larz60+
  difficulties to chage json data structure using json module in python Sibdar 1 2,043 Apr-03-2020, 06:47 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020