#json
#json
Вопрос:
"NewsML": [
{
"Identification": {"NewsIdentifier": {
"ProviderId": "timesofindia.com",
"NewsItemId": "7954765"
}},
"NewsLines": {
"HeadLine": "I want KKR to win for Ganguly: Shah Rukh",
"DateLine": "IANS, Apr 12, 2011, 04.41am IST"
},
"NewsComponent": [
{
"Role": {"@FormalName": "WebURL"},
"ContentItem": {
"MediaType": {"@FormalName": "Link"},
"DataContent": {"media-caption": "http://timesofindia.indiatimes.com/sports/cricket/ipl-2011/news/I-want-KKR-to-win-for-Ganguly-Shah-Rukh/articleshow/7954765.cms"}
}
},
{
"Role": {"@FormalName": "Caption"},
"ContentItem": {
"MediaType": {"@FormalName": "Text"},
"DataContent": {"media-caption": "Aware of the negative vibes in Kolkata after the exclusion of Dada from the team, Shah Rukh Khan dedicated his team's victory to Sourav Ganguly."}
}
},
{
"Role": {"@FormalName": "Keywords"},
"ContentItem": {
"MediaType": {"@FormalName": "Text"},
"DataContent": {"media-keyword": "Sourav Ganguly, Shah Rukh Khan, KKR, IPL"}
}
},
{
"Role": {"@FormalName": "Photo"},
"ContentItem": {
"@Href": "http://timesofindia.indiatimes.com/photo.cms?photoid=7954812amp;phototype=1amp;width=400amp;height=300",
"MediaType": {"@FormalName": "Photo"},
"Format": {"@FormalName": "JPEG Baseline"},
"Characteristics": [
{
"@FormalName": "Width",
"@Value": "450"
},
{
"@FormalName": "Height",
"@Value": "300"
}
]
}
},
{
"Role": {"@FormalName": "Photo-Caption"},
"ContentItem": {
"MediaType": {"@FormalName": "Text"},
"DataContent": {"media-caption": "Kolkata Knight Riders owner Saha Rukh Khan greets his supporters during their IPL match against Deccan Chargers at Eden Gardens. (PTI photo)"}
}
},
{
"Role": {"@FormalName": "Thumb"},
"ContentItem": {
"@Href": "http://timesofindia.indiatimes.com/thumb.cms?photoid=7954812",
"MediaType": {"@FormalName": "Photo"},
"Format": {"@FormalName": "JPEG Baseline"}
}
},
{
"Role": {"@FormalName": "Story"},
"ContentItem": {
"MediaType": {"@FormalName": "Text"},
"DataContent": {"body": {"body.content": "KOLKATA: Aware of the negative vibes in Kolkata after the exclusion of local boy Sourav Ganguly from the team, Kolkata Knight Riders co-owner Shah Rukh Khan on Monday night dedicated his team's nine-run victory to Sourav Ganguly and the sports loving people of the city.nnI came back only for the fans. I wanted to do this for Knight Riders, the fans of Kolkata, I wanted to do this for Sourav Ganguly.nnI want my team KKR to win the IPL for Kolkata and Sourav Ganguly, said the matinee idol.nnI am very happy. It was really a cool moment. (Skipper Gautam) Gambhir and (Jacques) Kallis were really cool. It was really a cool moment as our team is unused to wins, said Shah Rukh Khan after KKR clinched their first win in IPL edition four.nnShah Rukh also expressed his disappointment over unnecessary controversies revolving the team for the last three seasons.nnA win is always welcome. We had lot of unnecessary controversies in the last three seasons, said Shah Rukh. "}}
}
}
]
},
}
]
Комментарии:
1. возможно, вам следует уточнить свой вопрос…
Ответ №1:
Json — это неправильная проверка http://www.jsonlint.com /
изменен json =
{
"NewsML": [
{
"Identification": {
"NewsIdentifier": {
"ProviderId": "timesofindia.com",
"NewsItemId": "7954765"
}
},
"NewsLines": {
"HeadLine": "I want KKR to win for Ganguly: Shah Rukh",
"DateLine": "IANS, Apr 12, 2011, 04.41am IST"
},
"NewsComponent": [
{
"Role": {
"@FormalName": "WebURL"
},
"ContentItem": {
"MediaType": {
"@FormalName": "Link"
},
"DataContent": {
"media-caption": "http://timesofindia.indiatimes.com/sports/cricket/ipl-2011/news/I-want-KKR-to-win-for-Ganguly-Shah-Rukh/articleshow/7954765.cms"
}
}
},
{
"Role": {
"@FormalName": "Caption"
},
"ContentItem": {
"MediaType": {
"@FormalName": "Text"
},
"DataContent": {
"media-caption": "Aware of the negative vibes in Kolkata after the exclusion of Dada from the team, Shah Rukh Khan dedicated his team's victory to Sourav Ganguly."
}
}
},
{
"Role": {
"@FormalName": "Keywords"
},
"ContentItem": {
"MediaType": {
"@FormalName": "Text"
},
"DataContent": {
"media-keyword": "Sourav Ganguly, Shah Rukh Khan, KKR, IPL"
}
}
},
{
"Role": {
"@FormalName": "Photo"
},
"ContentItem": {
"@Href": "http://timesofindia.indiatimes.com/photo.cms?photoid=7954812amp;phototype=1amp;width=400amp;height=300",
"MediaType": {
"@FormalName": "Photo"
},
"Format": {
"@FormalName": "JPEG Baseline"
},
"Characteristics": [
{
"@FormalName": "Width",
"@Value": "450"
},
{
"@FormalName": "Height",
"@Value": "300"
}
]
}
},
{
"Role": {
"@FormalName": "Photo-Caption"
},
"ContentItem": {
"MediaType": {
"@FormalName": "Text"
},
"DataContent": {
"media-caption": "Kolkata Knight Riders owner Saha Rukh Khan greets his supporters during their IPL match against Deccan Chargers at Eden Gardens. (PTI photo)"
}
}
},
{
"Role": {
"@FormalName": "Thumb"
},
"ContentItem": {
"@Href": "http://timesofindia.indiatimes.com/thumb.cms?photoid=7954812",
"MediaType": {
"@FormalName": "Photo"
},
"Format": {
"@FormalName": "JPEG Baseline"
}
}
},
{
"Role": {
"@FormalName": "Story"
},
"ContentItem": {
"MediaType": {
"@FormalName": "Text"
},
"DataContent": {
"body": {
"body.content": "KOLKATA: Aware of the negative vibes in Kolkata after the exclusion of local boy Sourav Ganguly from the team, Kolkata Knight Riders co-owner Shah Rukh Khan on Monday night dedicated his team's nine-run victory to Sourav Ganguly and the sports loving people of the city.nnI came back only for the fans. I wanted to do this for Knight Riders, the fans of Kolkata, I wanted to do this for Sourav Ganguly.nnI want my team KKR to win the IPL for Kolkata and Sourav Ganguly, said the matinee idol.nnI am very happy. It was really a cool moment. (Skipper Gautam) Gambhir and (Jacques) Kallis were really cool. It was really a cool moment as our team is unused to wins, said Shah Rukh Khan after KKR clinched their first win in IPL edition four.nnShah Rukh also expressed his disappointment over unnecessary controversies revolving the team for the last three seasons.nnA win is always welcome. We had lot of unnecessary controversies in the last three seasons, said Shah Rukh. "
}
}
}
}
]
}
]
}
Ответ №2:
Итак, вы хотите отобразить его пользователю? Возможно, я вас неправильно понял, но вы можете просто разобрать его в php с помощью json_decode();
Кроме того, вы можете проанализировать вывод JSON из php с помощью jQuery и добавить изображение в HTML DOM.