什么是解析JSON的代码?
我有以下JSON文本,我需要解析以获取pageName,pagePic,post_id等。
什么是必需的代码?
{
“pageInfo”:{“pageName”:“abc”,“pagePic”:“http://example.com/content.jpg”}“posts”:[{“post_id”:“123456789012_123456789012”,“actor_id”:“ 1234567890“,”picOfPersonWhoPosted“:”http://example.com/photo.jpg“,”nameOfPersonWhoPosted“:”Jane Doe“,”message“:”听起来很酷,等不及看到它!“,”likesCount “:”2“,”评论“:[],”timeOfPost“:”1234567890“}]}
在此处输入代码
var jsonString = "pageInfo": { "pageName": "abc", "pagePic": "http://example.com/content.jpg" } "posts": [ { "post_id": "123456789012_123456789012", "actor_id": "1234567890", "picOfPersonWhoPosted": "http://example.com/photo.jpg", "nameOfPersonWhoPosted": "Jane Doe", "message": "Sounds cool. Can't wait to see it!", "likesCount": "2", "comments": [], "timeOfPost": "1234567890" } ] }
JSON.parse(jsonString)
这里是代码
链接地址: http://www.djcxy.com/p/29959.html