I am trying to retrieve data from a json file which having multiple posts using php, I am new to json and can not retrieve each chunk of data from the file, In following json file it has two wordpress post which I want to retrieve but I am not able to retrieve the desire result. because this file is like complex to me and can not get data in jsonarray and jsonobject combination and I am confuse with that combination, Any help from respectable gurus will be highly appreciated.
[
{
"id": 5758,
"date": "2021-06-23T19:49:30",
"date_gmt": "2021-06-23T14:49:30",
"guid": {
"rendered": "http://mydoman.com/?p=5758"
},
"modified": "2021-06-23T19:49:38",
"modified_gmt": "2021-06-23T14:49:38",
"slug": "itisaslug",
"status": "publish",
"type": "post",
"link": "http://mydoman.com/short-stories/story/",
"title": {
"rendered": "it is a title"
},
"content": {
"rendered": "<p>Story is Short Story written by Writer name the social issue <!--more--><br
/>\n<img loading=\"lazy\" src=\"http://mydoman.com/mydomanstorier/Writername/storyimage-
1.gif\" width=\"499\" height=\"699\" alt=\"It is a alt text here, Page No. 1\"> <!--
nextpage--><br />\n<img loading=\"lazy\"
src=\"http://mydoman.com/stories/writer/Storyimage-2.gif\" width=\"499\" height=\"699\"
alt=\"Alt text here, Page No. 2\"> <!--nextpage--><br />\n<img loading=\"lazy\"
src=\"http://mydoman.com/stories/writer/storyimage-3.gif\" width=\"499\" height=\"699\"
alt=\"alt text here , Page No. 3\"></p>\n",
"protected": false
},
"excerpt": {
"rendered": "<p>excerpt text here</p>\n",
"protected": false
},
"author": 10,
"featured_media": 5759,
"comment_status": "open",
"ping_status": "open",
"sticky": false,
"template": "",
"format": "standard",
"meta": [],
"categories": [
4
],
"tags": [
479,
507,
212,
177,
179,
296
],
"jetpack_featured_media_url": "http://mydoman.com/wp-content/uploads/2021/06/featureimage-1.gif",
"_links": {
"self": [
{
"href": "http://mydoman.com/wp-json/wp/v2/posts/5758"
}
],
"collection": [
{
"href": "http://mydoman.com/wp-json/wp/v2/posts"
}
],
"about": [
{
"href": "http://mydoman.com/wp-json/wp/v2/types/post"
}
],
"author": [
{
"embeddable": true,
"href": "http://mydoman.com/wp-json/wp/v2/users/10"
}
],
"replies": [
{
"embeddable": true,
"href": "http://mydoman.com/wp-json/wp/v2/comments?post=5758"
}
],
"version-history": [
{
"count": 0,
"href": "http://mydoman.com/wp-json/wp/v2/posts/5758/revisions"
}
],
"wp:featuredmedia": [
{
"embeddable": true,
"href": "http://mydoman.com/wp-json/wp/v2/media/5759"
}
],
"wp:attachment": [
{
"href": "http://mydoman.com/wp-json/wp/v2/media?parent=5758"
}
],
"wp:term": [
{
"taxonomy": "category",
"embeddable": true,
"href": "http://mydoman.com/wp-json/wp/v2/categories?post=5758"
},
{
"taxonomy": "post_tag",
"embeddable": true,
"href": "http://mydoman.com/wp-json/wp/v2/tags?post=5758"
}
],
"curies": [
{
"name": "wp",
"href": "https://api.w.org/{rel}",
"templated": true
}
]
}
},
{
"id": 5684,
"date": "2021-06-20T13:10:01",
"date_gmt": "2021-06-20T08:10:01",
"guid": {
"rendered": "http://mydoman.com/?p=2345"
},
"modified": "2021-06-20T13:10:07",
"modified_gmt": "2021-06-20T08:10:07",
"slug": "set-up",
"status": "publish",
"type": "post",
"link": "http://mydoman.com/postlink-1/",
"title": {
"rendered": "this is a title"
},
"content": {
"rendered": "<p>It is a crime story written by writer name <!--more--></p>\n<p><img
loading=\"lazy\" src=\"http://mydoman.com/upload/image-1.gif\" width=\"499\" height=\"699\"
alt=\"alt text, Page No. 1\"> <!--nextpage--><br />\n<img loading=\"lazy\"
src=\"http://mydoman.com/upload/image-2.gif\" width=\"499\" height=\"699\" alt=\"alt text 2,
Page No. 2\"> <!--nextpage-->",
"protected": false
},
"excerpt": {
"rendered": "<p>excerpt text by the writer</p>\n",
"protected": false
},
"author": 10,
"featured_media": 5685,
"comment_status": "open",
"ping_status": "open",
"sticky": false,
"template": "",
"format": "standard",
"meta": [],
"categories": [
39
],
"tags": [
532,
195,
533,
91
],
"jetpack_featured_media_url": "http://mydoman.com/wp-content/uploads/2021/05/feature-image-url-1.gif",
"_links": {
"self": [
{
"href": "http://mydoman.com/wp-json/wp/v2/posts/5684"
}
],
"collection": [
{
"href": "http://mydoman.com/wp-json/wp/v2/posts"
}
],
"about": [
{
"href": "http://mydoman.com/wp-json/wp/v2/types/post"
}
],
"author": [
{
"embeddable": true,
"href": "http://mydoman.com/wp-json/wp/v2/users/10"
}
],
"replies": [
{
"embeddable": true,
"href": "http://mydoman.com/wp-json/wp/v2/comments?post=5684"
}
],
"version-history": [
{
"count": 0,
"href": "http://mydoman.com/wp-json/wp/v2/posts/5684/revisions"
}
],
"wp:featuredmedia": [
{
"embeddable": true,
"href": "http://mydoman.com/wp-json/wp/v2/media/5685"
}
],
"wp:attachment": [
{
"href": "http://mydoman.com/wp-json/wp/v2/media?parent=5684"
}
],
"wp:term": [
{
"taxonomy": "category",
"embeddable": true,
"href": "http://mydoman.com/wp-json/wp/v2/categories?post=5684"
},
{
"taxonomy": "post_tag",
"embeddable": true,
"href": "http://sohnidigest.com/wp-json/wp/v2/tags?post=5684"
}
],
"curies": [
{
"name": "wp",
"href": "https://api.w.org/{rel}",
"templated": true
}
]
}
}
]
source https://stackoverflow.com/questions/68958278/how-to-get-data-from-json-array-and-object-inside-json-arry-from-complex-json-fi
Comments
Post a Comment