res = urllib2.urlopen(request).read()
data = json.loads(res)
Traceback (most recent call last):
File "./translate.py", line 27, in data = json.loads(res)
File "/usr/lib/python2.6/json/__init__.py", line 307, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.6/json/decoder.py", line 319, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.6/json/decoder.py", line 336, in raw_decode
obj, end = self._scanner.iterscan(s, **kw).next()
File "/usr/lib/python2.6/json/scanner.py", line 55, in iterscan
rval, next_pos = action(m, context)
File "/usr/lib/python2.6/json/decoder.py", line 219, in JSONArray
raise ValueError(errmsg("Expecting object", s, end))
ValueError: Expecting object: line 1 column 158 (char 158)
если сделать print(res) то выводит:
[[["привет","hi","privet",""]],[["abbreviation",["Гавайи"]],["interjection",["привет","эй","ну","салют","здор `ово"]]],"en",,[["привет",[5],1,,1000,0,1,0]],[["hi",4,,,""],["hi",5,[["привет",1000,1,]],[[0,2]],"hi"]],,,,21]
<?php
$s = '[[["привет","hello","privet",""]],[["существительное",["приветствие","приветственный возглас","возглас удивления"]],["глагол",["здороваться","звать","окликать"]],["междометие",["привет","здравствуйте","алло"]]],"en",,[["привет",[5],1,,859,0,1,0]],[["hello",4,,,""],["hello",5,[["привет",859,1,],["Привете",0,1,],["Приветом",0,1,],["Привету",0,1,],["Привета",0,1,]],[[0,5]],"hello"]],,,,16]';
$s = preg_replace('`,{2,}`', ',', $s);
$s = str_replace(',]', ']', $s);
print_r(json_decode($s));