php操作JSON格式数据的实现代码
前端之家收集整理的这篇文章主要介绍了
php操作JSON格式数据的实现代码,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
知识点:
1、JSON数据格式介绍
2、对数据编码成JSON格式
3、对JSON数据进行解码,并操作
JSON数据格式表示方式如下:
<div class="codetitle"><a style="CURSOR: pointer" data="46842" class="copybut" id="copybut46842" onclick="doCopy('code46842')"> 代码如下:
<div class="codebody" id="code46842">
{ "programmers": [
{ "firstName": "Brett","lastName":"McLaughlin","email": "aaaa" },
{ "firstName": "Jason","lastName":"Hunter","email": "bbbb" },
{ "firstName": "Elliotte","lastName":"Harold","email": "cccc" }
],
"authors": [
{ "firstName": "Isaac","lastName": "Asimov","genre": "science fiction" },
{ "firstName": "Tad","lastName": "Williams","genre": "fantasy" },
{ "firstName": "Frank","lastName": "Peretti","genre": "christian fiction" }
],
"musicians": [
{ "firstName": "Eric","lastName": "Clapton","instrument": "guitar" },
{ "firstName": "Sergei","lastName": "Rachmaninoff","instrument": "piano" }
] }