Posts: 167
Joined: Jul 2012
Reputation:
5
just to save other peoples time I'm still working on adjusting the examples provided. Line 128 of Martijn's link seems the best candidate for me so far, as it allows me to preserve the JSON queries in their native form (lets me test easily in the REST client) and it should also strip away the unicode junk (u'Fancy Tag') far better than any regex I write will.
TBC and thanks thus far.
Posts: 3,489
Joined: Jan 2011
Reputation:
365
pkscout
Team-Kodi Member
Posts: 3,489
2013-05-03, 01:53
(This post was last modified: 2013-05-03, 01:54 by pkscout.)
Nevermind. I can't seem to delete my posts anymore.
Posts: 3,909
Joined: Dec 2004
Reputation:
20
Nuka1195
Skilled Python Coder
Posts: 3,909
How is it different. It's basically the same except for false, true and null.
Posts: 167
Joined: Jul 2012
Reputation:
5
2013-05-05, 16:43
(This post was last modified: 2013-05-05, 16:49 by wellspokenman.)
Print list.namedattribute
Or
Print list[0]
Doesn't work. I have to do that item.get command to return imdbIDs.
Also, I have to use Json.dumps to get the data into a readable/write able format. All in all quite different I would say.
Posts: 3,909
Joined: Dec 2004
Reputation:
20
Nuka1195
Skilled Python Coder
Posts: 3,909
Read my first response to your question.
Posts: 167
Joined: Jul 2012
Reputation:
5
"If you trust the source JSON is basically a python dict. "
Not exactly helpful.
Posts: 3,909
Joined: Dec 2004
Reputation:
20
Nuka1195
Skilled Python Coder
Posts: 3,909
?
You don't see the example? Just eval the JSON source to a dict.
Posts: 167
Joined: Jul 2012
Reputation:
5
"# JSON uses true, false and null
null = None
true = True
false = False
result = eval(json_source)"
I didn't see that no. But I still don't know how to use that to help me or even how to use that to read documentation that would help.
I'm not a skilled python coder. Not even close. I can do things with batch files that may surprise even the most experienced developer, but I'm really just a network admin who is looking for a new challenge. Python is my first "proper" language, so I need a little more guidance than was perhaps initially anticipated.
Posts: 167
Joined: Jul 2012
Reputation:
5
2013-05-06, 16:29
(This post was last modified: 2013-05-06, 16:31 by wellspokenman.)
Yeah - I needed json.dumps for reading the unicode in the movie names:
UnicodeEncodeError: 'ascii' codec can't encode character u'\xb3' in position 5: ordinal not in range(128)
is what happens without it.