Я создал JSon магазин в сенча прикосновением с помощью этого учебника https://www.youtube.com/watch?v=GQaPt-gQVRIСенча сенсорный 2,4 и twetter апи 1,1 в формате JSON в магазине
Json это выглядит следующим образом:
[
{
"created_at": "Sat Apr 05 20:06:38 +0000 2014",
"id": 34563456345646,
"id_str": "5643563456456",
"text": "My lovely boy: Adrian, 04.04.2014 only 2 hours old!!! http://t.co/1F8MhRa0eH",
"source": "<a href=\"http: //twitter.com/download/iphone\" rel=\"nofollow\">Twitter for iPhone</a>",
"truncated": false,
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
"in_reply_to_user_id_str": null,
"in_reply_to_screen_name": null,
"user": {
"id": 456456,
"id_str": "4356456",
"name": "xxxxx",
"screen_name": "xxxxxxx",
"location": "",
"description": "",
"url": null,
"entities": {
"description": {
"urls": [
]
}
},
"protected": false,
"followers_count": 8,
"friends_count": 18,
"listed_count": 0,
"created_at": "Fri Mar 09 00:08:22 +0000 2012",
"favourites_count": 1,
"utc_offset": 7200,
"time_zone": "Berlin",
"geo_enabled": false,
"verified": false,
"statuses_count": 11,
"lang": "en",
"contributors_enabled": false,
"is_translator": false,
"is_translation_enabled": false,
"profile_background_color": "282828",
"profile_background_image_url": "http://pbs.twimg.com/profile_background_images/577489227/58nipt5bo41ae2tkq02g.jpeg",
"profile_background_image_url_https": "https://pbs.twimg.com/profile_background_images/577489227/58nipt5bo41ae2tkq02g.jpeg",
"profile_background_tile": false,
"profile_image_url": "http://pbs.twimg.com/profile_images/1882584072/image_normal.jpg",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/1882584072/image_normal.jpg",
"profile_link_color": "FC0243",
"profile_sidebar_border_color": "D0F2DD",
"profile_sidebar_fill_color": "D3DFD1",
"profile_text_color": "D7CAC3",
"profile_use_background_image": true,
"has_extended_profile": false,
"default_profile": false,
"default_profile_image": false,
"following": false,
"follow_request_sent": false,
"notifications": false
},
"geo": null,
"coordinates": null,
"place": null,
"contributors": null,
"is_quote_status": false,
"retweet_count": 0,
"favorite_count": 0,
"entities": {
"hashtags": [
],
"symbols": [
],
"user_mentions": [
],
"urls": [
],
"media": [
{
"id": 452537815365333000,
"id_str": "452537815365332992",
"indices": [
55,
77
],
"media_url": "http://pbs.twimg.com/media/Bke8vtRIMAAB2QK.jpg",
"media_url_https": "https://pbs.twimg.com/media/Bke8vtRIMAAB2QK.jpg",
"url": "http://t.co/1F8MhRa0eH",
"display_url": "pic.twitter.com/1F8MhRa0eH",
"expanded_url": "http://twitter.com/xxxxxx/status/452537817038848001/photo/1",
"type": "photo",
"sizes": {
"small": {
"w": 340,
"h": 255,
"resize": "fit"
},
"medium": {
"w": 600,
"h": 450,
"resize": "fit"
},
"thumb": {
"w": 150,
"h": 150,
"resize": "crop"
},
"large": {
"w": 1024,
"h": 768,
"resize": "fit"
}
}
}
]
},
"extended_entities": {
"media": [
{
"id": 452537815365333000,
"id_str": "452537815365332992",
"indices": [
55,
77
],
"media_url": "http://pbs.twimg.com/media/Bke8vtRIMAAB2QK.jpg",
"media_url_https": "https://pbs.twimg.com/media/Bke8vtRIMAAB2QK.jpg",
"url": "http://t.co/1F8MhRa0eH",
"display_url": "pic.twitter.com/1F8MhRa0eH",
"expanded_url": "http://twitter.com/xxxxx/status/452537817038848001/photo/1",
"type": "photo",
"sizes": {
"small": {
"w": 340,
"h": 255,
"resize": "fit"
},
"medium": {
"w": 600,
"h": 450,
"resize": "fit"
},
"thumb": {
"w": 150,
"h": 150,
"resize": "crop"
},
"large": {
"w": 1024,
"h": 768,
"resize": "fit"
}
}
}
]
},
"favorited": false,
"retweeted": false,
"possibly_sensitive": false,
"lang": "en"
}
} ] но json-данные слишком сложны, и я не могу получить media_url в сущности, я сделал сопоставление в модели для достижения другой части, но отображение не работает в случае media_url !!
, пожалуйста, дайте мне знать, как решить эту проблему.
Тпй за вашу помощь, к сожалению, получает ошибку «неперехваченного ReferenceError: запись не определена» в варе сущностях = record.get («лицо») ;, это выглядит, как это id не определен! – PFK
вам нужно определить одно поле в модели с именами объектов и сопоставить их с объектами в объекте json .. тогда он будет работать, если у вас есть какая-либо проблема, предоставит мне фрагмент кода модели, который я изменю и дам вам, – Amar1989