我的JSON有些问题...我从另一个文件解码我的JSON后无法获得数组...我无法理解为什么会发生这种情况......我已阅读并且从互联网和stackoverflow尝试了许多其他变种,但这些解决方案并没有帮助我=( 这是我的Json_encode的一部分
{
"r_app": " 1",
"data_napr": "2005-07-25",
"doc_napravl": "PROFILAKTISK\u0100 MG",
"data_opis": "17.08.2007",
"pac_pk": "120842-11217",
"pac_name": "ludmila",
"pac_surname": "solovjova",
"opis": "]MAMMOGR\u0100FIJA\r\n Abos kr\u016b\u0161u dziedzeros aug\u0161\u0113jos kvadrantos dif\u016bzi, augstas intensit\u0101tes, rupji \u0161\u0137iedraini,\r\n per\u0113k\u013caini ar tendenci sapl\u016bst fibroglandul\u0101ri audi. \r\n Kreisaj\u0101 kr\u016bt\u012b aug\u0161\u0113j\u0101 medi\u0101laj\u0101 kvadrant\u0101 ovalas formas, gludi kontur\u0113ts veidojums 0,9x0,7cm ar kalcin\u0101tu.\r\n\r\n SL\u0112DZIENS: [ Bilater\u0101li fibroglandul\u0101ro audu hiperpl\u0101zija. Gl.mammae sin. veidojums.\r\n Lai preciz\u0113tu veidojuma raksturu nepiecie\u0161ama US izmekl\u0113\u0161ana, v\u0113lama onkologa \r\n konsult\u0101cija. ]",
"doc_num": "0042",
"nr_is": "20070828-M011",
"apparati": "1; 4;",
"prefiks": "DXRF",
"doctor_diagnost": "Gaina Kalna"
}{
"r_app": " 1",
"data_napr": "2005-07-25",
"doc_napravl": "PROFILAKTISK\u0100 MG",
"data_opis": "15.04.2008",
"pac_pk": "120842-11217",
"pac_name": "ludmila",
"pac_surname": "solovjova",
"opis": "]KR\u016a\u0160U DZIEDZERA US\r\n Abos kr\u016b\u0161u dziedzeros aug\u0161\u0113jos later\u0101lajos kvadrantos dif\u016bzi, haotiski fibrozi audi.\r\n Kreisaj\u0101 kr\u016bt\u012b aug\u0161\u0113j\u0101 medi\u0101laj\u0101 kvadrant\u0101 nekonkr\u0113tas formas, skaidri norobe\u017eots\r\n pazemin\u0101tas ehogenit\u0101tes, ar kalcin\u0101tiem veidojums 0,8x0,5cm.\r\n Reg. axillaris bilateralis nespecifiski limfmezgli.\r\n\r\n SL\u0112DZIENS: Gl.mammae sin. veidojums.\r\n Nepiecie\u0161ami sal\u012bdzin\u0101t ar iepriek\u0161. MG] .",
"doc_num": "0042",
"nr_is": "20080415-K121",
"apparati": "1; 4;",
"prefiks": "DXRF",
"doctor_diagnost": "Gaina Kalna"
}{
"r_app": " 1",
"data_napr": "2005-07-25",
"doc_napravl": "PROFILAKTISK\u0100 MG",
"data_opis": "15.04.2008",
"pac_pk": "120842-11217",
"pac_name": "ludmila",
"pac_surname": "solovjova",
"opis": "Uz\u0146\u0113mumu apraksts RIS nav veikts. ]",
"doc_num": "0003",
"nr_is": "20080416-0810",
"apparati": "1; 4;",
"prefiks": "DXRF",
"doctor_diagnost": "Svetlana Temerbeka"
}{
"r_app": " 1",
"data_napr": "2005-07-25",
"doc_napravl": "PROFILAKTISK\u0100 MG",
"data_opis": "17.06.2009",
"pac_pk": "120842-11217",
"pac_name": "ludmila",
"pac_surname": "solovjova",
"opis": "ELEKTROKARDIOGR\u0100FIJA\r\n \r\n M\u0113rena sinusa tahikardija 90x'. Horizont\u0101la el. ass. Nespecifiskas T zoba p\u0101rmai\u0146as? Kreis\u0101 kambara hemodinamiska p\u0101rslodze? Sal\u012bdzinot ar Ekg 27.07.05. miokarda trofikas iev\u0113rojama pasliktin\u0101\u0161an\u0101s. Ekg dinamik\u0101.",
"doc_num": "0150",
"nr_is": "20090617-L341",
"apparati": "1; 4;",
"prefiks": "DXRF",
"doctor_diagnost": "Ilze Ddia"
}{
"r_app": " 1",
"data_napr": "2005-07-25",
"doc_napravl": "PROFILAKTISK\u0100 MG",
"data_opis": "09.07.2009",
"pac_pk": "120842-11217",
"pac_name": "ludmila",
"pac_surname": "solovjova",
"opis": "]DIGIT\u0100L\u0100 MAMMOGR\u0100FIJA ar \u013caundab\u012bgo audz\u0113ju datormekl\u0113\u0161anas sist\u0113mu (CAD)\r\n Fibrolipomatozas p\u0101rmai\u0146as ab\u0101s kr\u016bt\u012bs. \r\n Abos kr\u016b\u0161u dziedzeros aug\u0161\u0113jos later\u0101lajos kvadrantos, retroareol\u0101ri- centr\u0101li\r\n dif\u016bzi, vid\u0113jas intensit\u0101tes, rupji\u0161\u0137iedraini, per\u0113k\u013caini, ar tendenci sapl\u016bst fibroglandul\u0101rie audi.\r\n Kreisaj\u0101 kr\u016bt\u012b medi\u0101li no mammilas reduc\u0113ta fibroadenoma 0,9cm.\r\nLabaj\u0101 kr\u016bt\u012b retroareol\u0101ri \/ LLpr.\/ vid\u0113jas intensit\u0101tes nodul\u0101ra strukt\u016bra 1,0cm- visticam\u0101k fibroza rakstura bet j\u0101diferenc\u0113 no veidojuma.\r\n\r\n SL\u0112DZIENS: Bilater\u0101las fibrocistiskas mastop\u0101tijas paz\u012bmes. \r\n Gl.mammae sin. reduc\u0113ta fibroadenoma.\r\n Lai preciz\u0113tu gl.mammae dx. izmai\u0146as, papildus nepiecie\u0161ama\r\n US izmekl\u0113\u0161ana.]",
"doc_num": "0042",
"nr_is": "20090715-M111",
"apparati": "1; 4;",
"prefiks": "DXRF",
"doctor_diagnost": "Gaina Kalna"
}{
"r_app": " 1",
"data_napr": "2005-07-25",
"doc_napravl": "PROFILAKTISK\u0100 MG",
"data_opis": "04.12.2009",
"pac_pk": "120842-11217",
"pac_name": "ludmila",
"pac_surname": "solovjova",
"opis": "KR\u016a\u0160U DZIEDZERU US\r\n Piena dziedzeri fibrolipomatozi. Dziedzeraudi hiperehog\u0113ni, \u0161\u0137iedrainu str-ru. Kr. pus\u0113 aug\u0161\u0113j\u0101 med. kvadr\u0101t\u0101- 0.5 cm ka\u013c\u0137ots veidojums, j\u0101dom\u0101, f\/adenoma. Citus veidojumus, palielin\u0101tus l\/mezglus sonoskopiski p\u0101rliecino\u0161i neredz.",
"doc_num": "0085",
"nr_is": "20091204-E101",
"apparati": "1; 4;",
"prefiks": "DXRF",
"doctor_diagnost": "Elita Maarenko"
}{
"r_app": " 1",
"data_napr": "2005-07-25",
"doc_napravl": "PROFILAKTISK\u0100 MG",
"data_opis": "10.02.2010",
"pac_pk": "120842-11217",
"pac_name": "ludmila",
"pac_surname": "solovjova",
"opis": "ELEKTROKARDIOGR\u0100FIJA\r\n \r\n \r\n\r\n Sinusa ritms 78x'. Sinistrogramma. Nespecifiskas T vi\u013c\u0146a p\u0101rmai\u0146as. Sal\u012bdzinot ar iepriek\u0161\u0113jo EKG 17.06.09. miokarda trofikas uzlabo\u0161an\u0101s.",
"doc_num": "0150",
"nr_is": "20100210-L141",
"apparati": "1; 4;",
"prefiks": "DXRF",
"doctor_diagnost": "Ilze Ddia"
}{
"r_app": " 1",
"data_napr": "2005-07-25",
"doc_napravl": "PROFILAKTISK\u0100 MG",
"data_opis": "12.08.2010",
"pac_pk": "120842-11217",
"pac_name": "ludmila",
"pac_surname": "solovjova",
"opis": "ELEKTROKARDIOGR\u0100FIJA\r\n \r\n\r\n M\u0113rena sinusa tahikardija 92x'. Horizont\u0101la elektrisk\u0101 ass.\r\nKreis\u0101 \u0101trija p\u0101rslodzes paz\u012bmes.\r\nNespecifiskas T vi\u013c\u0146a p\u0101rmai\u0146as.\r\nSal\u012bdzinot ar iepriek\u0161\u0113jo EKG 10.02.10. bez b\u016btiskas dinamikas.",
"doc_num": "0150",
"nr_is": "20100812-L0111",
"apparati": "1; 4;",
"prefiks": "DXRF",
"doctor_diagnost": "Ilze Ddia"
}{
"r_app": " 1",
"data_napr": "2005-07-25",
"doc_napravl": "PROFILAKTISK\u0100 MG",
"data_opis": "01.09.2010",
"pac_pk": "120842-11217",
"pac_name": "ludmila",
"pac_surname": "solovjova",
"opis": "DIGIT\u0100L\u0100 MAMMOGR\u0100FIJA ar \u013caundab\u012bgo audz\u0113ju datormekl\u0113\u0161anas sist\u0113mu (CAD) - sal\u012bdzinot ar 09.07.2009\r\n \r\nNedaudz t\u016bskaina, biez\u0101ka \u0101da areol\u0101raj\u0101s zon\u0101s.\r\nFibrolipomatozas p\u0101rmai\u0146as ab\u0101s kr\u016bt\u012bs. \r\n Abos piena dziedzeros aug\u0161\u0113jos later\u0101lajos kvadrantos, retroareol\u0101ri - centr\u0101li dif\u016bzi, vid\u0113jas intensit\u0101tes, rupji\u0161\u0137iedraini, per\u0113k\u013caini, ar tendenci sapl\u016bst fibroglandul\u0101rie audi - progres\u0113 rezidu\u0101las p\u0101rmai\u0146as.\r\n Kreisaj\u0101 piena dziedzer\u012b medi\u0101li no mammilas reduc\u0113ta fibroadenoma ~ 4 x 5 mm (iepriek\u0161: 0,9 cm).\r\nLabaj\u0101 piena dziedzer\u012b iepriek\u0161 redz\u0113ta retroareol\u0101ri \/ LLpr.\/ vid\u0113jas intensit\u0101tes nodul\u0101ra strukt\u016bra 1,0 cm (ecin\u0101jums: visticam\u0101k fibroza rakstura, bet j\u0101diferenc\u0113 no veidojuma, pa\u0161reiz labaj\u0101 piena dziedzer\u012b retroareol\u0101ri veidojumus nekonstat\u0113.\r\n\r\n SL\u0112DZIENS: [ Bilater\u0101las fibrocistiskas mastop\u0101tijas paz\u012bmes, kas mazin\u0101s dinamik\u0101. P\u0113c profilaktisko izmekl\u0113jumu rezult\u0101tu koda atbilst R2 (potenci\u0101li labdab\u012bga atrade). ] \r\n\r\n REKOMEND\u0100CIJAS: ieteicama US izmekl\u0113\u0161ana. Rekomend\u0113ts izmekl\u0113jums un izveidots e-nos\u016bt\u012bjums Nr. US100906-V-0-48692",
"doc_num": "0027",
"nr_is": "20100906-M0071",
"apparati": "1; 4;",
"prefiks": "DXRF",
"doctor_diagnost": "Elizabete Kadakovska"
}{
"r_app": " 1",
"data_napr": "2005-07-25",
"doc_napravl": "PROFILAKTISK\u0100 MG",
"data_opis": "27.10.2011",
"pac_pk": "120842-11217",
"pac_name": "ludmila",
"pac_surname": "solovjova",
"opis": "] ]V\u0112DERA DOBUMA ORG\u0100NU US\r\n \r\n\r\nAknas parasta lieluma,homog\u0113nas.\r\n\u017dultsp\u016bsl\u012b vair\u0101ku nelielu konkrementu \u0113nas.\r\n\u017dultsvadi nav papla\u0161in\u0101ti.\r\nPancreas vizualiz\u0113jas da\u013c\u0113ji,patolo\u0123iju neredzu.\r\nLab\u0101 niere~9,5cm,pl\u0101n\u0101ku parenh\u012bmu.\r\nKreis\u0101 niere~12cm,dubult] niere,taj\u0101 cista~4cm.\r\nLiesa~9cm,homog\u0113na.\r\nUr\u012bnsp\u016bslis tuk\u0161s, neizv\u0113rt\u0113jams. \r\n\r\n\r\n SL\u0112DZIENS: [ \u017d.p\u016b\u0161\u013ca konkrementi.P\u0113ciekaisuma izmai\u0146as lb.nier\u0113.Cista kr.nier\u0113.",
"doc_num": "0204",
"nr_is": "20111027-E0200",
"apparati": "1; 4;",
"prefiks": "DXRF",
"doctor_diagnost": "Ilze Simanovia"
}{
"r_app": " 1",
"data_napr": "2005-07-25",
"doc_napravl": "PROFILAKTISK\u0100 MG",
"data_opis": "05.12.2011",
"pac_pk": "120842-11217",
"pac_name": "ludmila",
"pac_surname": "solovjova",
"opis": "]KREIS\u0100S CE\u013bA LOC\u012aTAVAS DIGIT\u0100L\u0100 RENTGENOGRAMMA\r\n Loc\u012btavas sprauga asimetriska platuma- viegli sa\u0161aurin\u0101ta medi\u0101li; loc\u012btavas virsmas gludas, ar s\u012bk\u0101m s\u0101nu deform\u0101cij\u0101m. Pastiprin\u0101ta loc\u012btavas virsmu skleroze. \r\r SL\u0112DZIENS: [ Inici\u0101la deform\u0113jo\u0161a osteoartroze. ]",
"doc_num": "0085",
"nr_is": "20111205-00131",
"apparati": "1; 4;",
"prefiks": "DXRF",
"doctor_diagnost": "Elita Maarenko"
}{
"r_app": " 1",
"data_napr": "2005-07-25",
"doc_napravl": "PROFILAKTISK\u0100 MG",
"data_opis": "06.12.2011",
"pac_pk": "120842-11217",
"pac_name": "ludmila",
"pac_surname": "solovjova",
"opis": "KREIS\u0100S G\u016a\u017dAS LOC\u012aTAVAS DIGIT\u0100L\u0100 RENTGENOGRAMMA\r\n \rKreis\u0101s g\u016b\u017eas loc\u012btavas kaulu strukt\u016bra neviendab\u012bga, ar izteiktu subhondr\u0101lu sklerozi aug\u0161\u0113j\u0101s artikul\u0113jo\u0161\u0101s virsmas, ar saglab\u0101tu loc\u012btavas spraugu. S\u012bki margin\u0101lie osteof\u012bti. \r\r SL\u0112DZIENS: [ M\u0113rena deform\u0113jo\u0161a osteoartroze. M\u0113rena osteoporoze. ]",
"doc_num": "0004",
"nr_is": "20111206-00101",
"apparati": "1; 4;",
"prefiks": "DXRF",
"doctor_diagnost": "Ilze Kazka"
}{
"r_app": " 1",
"data_napr": "2005-07-25",
"doc_napravl": "PROFILAKTISK\u0100 MG",
"data_opis": "06.01.2012",
"pac_pk": "120842-11217",
"pac_name": "ludmila",
"pac_surname": "solovjova",
"opis": "]MUGURKAULA JOSTAS DA\u013bAS DIGIT\u0100L\u0100 RENTGENOGRAMMA (STANDARTPROJEKCIJ\u0100S)\r\n Mugurkaula jostas da\u013cas fiziolo\u0123isk\u0101 lordoze pastiprin\u0101ta.\r\nvL5 anteriolist\u0113ze par 8-9 mm. \r\n Starpskrieme\u013cu spraugas nevienm\u0113r\u012bga platuma, ar subhondr\u0101lu sklerozi, L5-S1 sprauga sa\u0161aurin\u0101ta. \r\nStarpskrieme\u013cu loc\u012btavas nevienm\u0113r\u012bga platuma, ar subhondr\u0101lu sklerozi. \r\n\r\n SL\u0112DZIENS: [ L5 -S1 starpskrieme\u013cu spondilozes paz\u012bmes, L5 skrieme\u013ca spondilolist\u0113ze.\r\n P\u0101r\u0113jos skrieme\u013cos prevel\u0113 artroze. ]",
"doc_num": "0003",
"nr_is": "20120106-00141",
"apparati": "1; 4;",
"prefiks": "DXRF",
"doctor_diagnost": "Svetlana Temerbeka"
}{
"r_app": " 1",
"data_napr": "2005-07-25",
"doc_napravl": "I\u013bMIRA KA\u013bINKINA",
"data_opis": "10.11.2011",
"pac_pk": "120960-10404",
"pac_name": "ludmila",
"pac_surname": "kameneva",
"opis": "]KREIS\u0100S PLAUKSTAS LOCITAVAS DIGIT\u0100L\u0100 RENTGENOGRAMMA\r\n Plaukstas loc\u012btavas radi\u0101la kaula dist\u0101l\u0101s metaf\u012bzes iesp\u0113jams neliela kompresija , traumas rezult\u0101t\u0101. \r\n Os scaphoideum margin\u0101la deform\u0101cija, strukt\u016bra izteikti neviendab\u012bga, skleroz\u0113ta- p\u0113c p\u0101rciesta l\u016bzuma.\r\n\r\n SL\u0112DZIENS: [ Os scaphoideum abu polu l\u016bzumi, m\u0113reni izteiktas konsolid\u0101cijas un rumb\u0113juma paz\u012bmes . ]",
"doc_num": "0003",
"nr_is": "20111111-00491",
"apparati": "1; 4;",
"prefiks": "DXRF",
"doctor_diagnost": "Svetlana Temerbeka"
}
这是我如何在另一个.php脚本中解码它
$filial_data = json_decode(preg_replace('/\s+/', '',$filial_data), TRUE);
var_dump($filial_data);
并返回null
我的问题是什么想法?
我从FoxPro DB获得的P.S数据已转换为utf-8编码,此数据的语言为拉脱维亚语
答案 0 :(得分:1)
您的JSON无效。您在JSON中有多个对象,这是不允许的。如果你想返回多个对象,你需要将它们放在一个数组中,所以它看起来像(这个例子只显示3个对象,其余的是相同的):
[Symfony\Component\Debug\Exception\UndefinedMethodException] Attempted to call method "getDoctrine" on class "Elastica\CoreBundle\Comman d\EmailCommand".
问题可能在于您的代码中发送了JSON。它看起来像是在做:
[{
"r_app": " 1",
"data_napr": "2005-07-25",
"doc_napravl": "PROFILAKTISK\u0100 MG",
"data_opis": "17.08.2007",
"pac_pk": "120842-11217",
"pac_name": "ludmila",
"pac_surname": "solovjova",
"opis": "]MAMMOGR\u0100FIJA\r\n Abos kr\u016b\u0161u dziedzeros aug\u0161\u0113jos kvadrantos dif\u016bzi, augstas intensit\u0101tes, rupji \u0161\u0137iedraini,\r\n per\u0113k\u013caini ar tendenci sapl\u016bst fibroglandul\u0101ri audi. \r\n Kreisaj\u0101 kr\u016bt\u012b aug\u0161\u0113j\u0101 medi\u0101laj\u0101 kvadrant\u0101 ovalas formas, gludi kontur\u0113ts veidojums 0,9x0,7cm ar kalcin\u0101tu.\r\n\r\n SL\u0112DZIENS: [ Bilater\u0101li fibroglandul\u0101ro audu hiperpl\u0101zija. Gl.mammae sin. veidojums.\r\n Lai preciz\u0113tu veidojuma raksturu nepiecie\u0161ama US izmekl\u0113\u0161ana, v\u0113lama onkologa \r\n konsult\u0101cija. ]",
"doc_num": "0042",
"nr_is": "20070828-M011",
"apparati": "1; 4;",
"prefiks": "DXRF",
"doctor_diagnost": "Gaina Kalna"
},{
"r_app": " 1",
"data_napr": "2005-07-25",
"doc_napravl": "PROFILAKTISK\u0100 MG",
"data_opis": "15.04.2008",
"pac_pk": "120842-11217",
"pac_name": "ludmila",
"pac_surname": "solovjova",
"opis": "]KR\u016a\u0160U DZIEDZERA US\r\n Abos kr\u016b\u0161u dziedzeros aug\u0161\u0113jos later\u0101lajos kvadrantos dif\u016bzi, haotiski fibrozi audi.\r\n Kreisaj\u0101 kr\u016bt\u012b aug\u0161\u0113j\u0101 medi\u0101laj\u0101 kvadrant\u0101 nekonkr\u0113tas formas, skaidri norobe\u017eots\r\n pazemin\u0101tas ehogenit\u0101tes, ar kalcin\u0101tiem veidojums 0,8x0,5cm.\r\n Reg. axillaris bilateralis nespecifiski limfmezgli.\r\n\r\n SL\u0112DZIENS: Gl.mammae sin. veidojums.\r\n Nepiecie\u0161ami sal\u012bdzin\u0101t ar iepriek\u0161. MG] .",
"doc_num": "0042",
"nr_is": "20080415-K121",
"apparati": "1; 4;",
"prefiks": "DXRF",
"doctor_diagnost": "Gaina Kalna"
},{
"r_app": " 1",
"data_napr": "2005-07-25",
"doc_napravl": "PROFILAKTISK\u0100 MG",
"data_opis": "15.04.2008",
"pac_pk": "120842-11217",
"pac_name": "ludmila",
"pac_surname": "solovjova",
"opis": "Uz\u0146\u0113mumu apraksts RIS nav veikts. ]",
"doc_num": "0003",
"nr_is": "20080416-0810",
"apparati": "1; 4;",
"prefiks": "DXRF",
"doctor_diagnost": "Svetlana Temerbeka"
}]
它应该将所有行收集到一个数组中并立即返回它们:
while ($row = fetch()) {
echo json_encode($row);
}
答案 1 :(得分:0)
您尝试同时解码多个json
数据,尝试单独解码
示例首先执行,然后启动第二个
{
"r_app": " 1",
"data_napr": "2005-07-25",
"doc_napravl": "PROFILAKTISK\u0100 MG",
"data_opis": "17.08.2007",
"pac_pk": "120842-11217",
"pac_name": "ludmila",
"pac_surname": "solovjova",
"opis": "]MAMMOGR\u0100FIJA\r\n Abos kr\u016b\u0161u dziedzeros aug\u0161\u0113jos kvadrantos dif\u016bzi, augstas intensit\u0101tes, rupji \u0161\u0137iedraini,\r\n per\u0113k\u013caini ar tendenci sapl\u016bst fibroglandul\u0101ri audi. \r\n Kreisaj\u0101 kr\u016bt\u012b aug\u0161\u0113j\u0101 medi\u0101laj\u0101 kvadrant\u0101 ovalas formas, gludi kontur\u0113ts veidojums 0,9x0,7cm ar kalcin\u0101tu.\r\n\r\n SL\u0112DZIENS: [ Bilater\u0101li fibroglandul\u0101ro audu hiperpl\u0101zija. Gl.mammae sin. veidojums.\r\n Lai preciz\u0113tu veidojuma raksturu nepiecie\u0161ama US izmekl\u0113\u0161ana, v\u0113lama onkologa \r\n konsult\u0101cija. ]",
"doc_num": "0042",
"nr_is": "20070828-M011",
"apparati": "1; 4;",
"prefiks": "DXRF",
"doctor_diagnost": "Gaina Kalna"
}
http://json.parser.online.fr/网站将帮助您了解有关json decode的更多信息