Convert multiple json entries in php to an array {"SchemeName": "design scheme for ontology protection engineering of Hutian kiln site (Hulu Kiln and horseshoe kiln)", "SchemeType": "technical solution (delegated to a third party )", "DeclareYear": "2014", "SchemeStatus": "under review", "Province": "Jiangxi Province" },{ "SchemeN php multiple json strings converted to Arrays
{"SchemeName": "design scheme for ontology protection engineering of Hutian kiln site (Hulu Kiln and horseshoe kiln)", "SchemeType": "technical solution (delegated to a third party)", "DeclareYear ": "2014", "SchemeStatus": "under review", "Province": "Jiangxi Province" },{ "SchemeName": "South Gate of Gongcheng, yuanzhongdu ruins, dump Protection Project at southwest corner ", "SchemeType": "technical solution (delegated to a third party)", "DeclareYear": "2014", "SchemeStatus": "under review", "Province": "Hebei Province "}, {"SchemeName": "yuanzhongdu site environmental rectification project", "SchemeType": "technical solution (delegated to a third party)", "DeclareYear": "2014", "SchemeStatus ": "under review", "Province": "Hebei Province" },{ "SchemeName": "Neiqiu Xing Kiln site protection greenhouses", "SchemeType": "technical solution (delegated to a third party )", "DeclareYear": "2014", "SchemeStatus": "reviewing", "Province": "Hebei Province "}
How to convert to an array
------ Solution --------------------
Brackets
Pay attention to UTF-8 encoding.
$ S = <TXT
[{"SchemeName": "design scheme for ontology protection engineering of Hutian kiln site (Hulu Kiln and horseshoe kiln)", "SchemeType": "technical solution (delegated to a third party)", "DeclareYear ": "2014", "SchemeStatus": "under review", "Province": "Jiangxi Province" },{ "SchemeName": "South Gate of Gongcheng, yuanzhongdu ruins, dump Protection Project at southwest corner ", "SchemeType": "technical solution (delegated to a third party)", "DeclareYear": "2014", "SchemeStatus": "under review", "Province": "Hebei Province "}, {"SchemeName": "yuanzhongdu site environmental rectification project", "SchemeType": "technical solution (delegated to a third party)", "DeclareYear": "2014", "SchemeStatus ": "under review", "Province": "Hebei Province" },{ "SchemeName": "Neiqiu Xing Kiln site protection greenhouses", "SchemeType": "technical solution (delegated to a third party )", "DeclareYear": "2014", "SchemeStatus": "reviewing", "Province": "Hebei Province"}]
TXT;
Print_r (json_decode ($ s, 1 ));
Array
(
[0] => Array
(
[SchemeName] => solution for ontology protection engineering of the Hutian kiln site (Hulu Kiln and horseshoe kiln)
[SchemeType] => technical solution (delegated to a third party)
[DeclareYear] = & gt; 2014
[SchemeStatus] => reviewing
[Province] => Jiangxi
)
[1] => Array
(
[SchemeName] => Earth tamping protection project at South Gate and southwest corner of Gongcheng, yuanzhongdu ruins
[SchemeType] => technical solution (delegated to a third party)
[DeclareYear] = & gt; 2014
[SchemeStatus] => reviewing
[Province] => Hebei
)
[2] => Array
(
[SchemeName] => yuanzhongdu site environmental rectification project
[SchemeType] => technical solution (delegated to a third party)
[DeclareYear] = & gt; 2014
[SchemeStatus] => reviewing
[Province] => Hebei
)
[3] => Array
(
[SchemeName] => Neiqiu Xingyao Ruins Protection greenhouses
[SchemeType] => technical solution (delegated to a third party)
[DeclareYear] = & gt; 2014
[SchemeStatus] => reviewing
[Province] => Hebei
)
)
------ Solution --------------------
$ Str = <
[{"SchemeName": "design scheme for ontology protection engineering of Hutian kiln site (Hulu Kiln and horseshoe kiln)", "SchemeType": "technical solution (delegated to a third party)", "DeclareYear ": "2014", "SchemeStatus": "under review", "Province": "Jiangxi Province" },{ "SchemeName": "South Gate of Gongcheng, yuanzhongdu ruins, dump Protection Project at southwest corner ", "SchemeType": "technical solution (delegated to a third party)", "DeclareYear": "2014", "SchemeStatus": "under review", "Province": "Hebei Province "}, {"SchemeName": "yuanzhongdu site environmental rectification project", "SchemeType": "technical solution (delegated to a third party)", "DeclareYear": "2014", "SchemeStatus ": "under review", "Province": "Hebei Province" },{ "SchemeName": "Neiqiu Xing Kiln site protection greenhouses", "SchemeType": "technical solution (delegated to a third party )", "DeclareYear": "2014", "SchemeStatus": "reviewing", "Province": "Hebei Province"}]
Phps;
Var_dump (json_decode ($ str, true ));