Click here to Skip to main content
15,885,839 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
{"orders":[{"id":1},{"id":2},{"id":3},{"id":4},{"id":5},{"id":6},{"id":7},{"id":8},{"id":9},{"id":10},{"id":11},{"id":648},{"id":649},{"id":650},{"id":651},{"id":652},{"id":653}],"errors":[{"code":3,"message":"[PHP Warning #2] count(): Parameter must be an array or an object that implements Countable (153)"}]}


What I have tried:

my_dic['orders'].str.extract('\d+')
Posted
Updated 13-Jul-22 6:28am

None of the information in your sample data has any colour specification, or indeed any presentation information at all: it's a chunk of JSON data that appears to be an error message of some form.

I'd suspect you need to look at exactly where you got that data from: the app is applying colours to the data, and there is nothing in there that in isolation allows you to extract it based on that applied colour.
 
Share this answer
 
c = {"orders":[{"id":1},{"id":2},{"id":3},{"id":4},{"id":5},{"id":6},{"id":7},{"id":8},{"id":9},{"id":10},{"id":11},{"id":648},{"id":649},{"id":650},{"id":651},{"id":652},{"id":653}],"errors":[{"code":3,"message":"[PHP Warning #2] count(): Parameter must be an array or an object that implements Countable (153)"}]}

m = []
for i in c.values():
for j in i:
for k in j.values():
if type(k) == int:
m.append(k)

print(m)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900