murphyspace
New Member
I am using JSON API and wants to parse post content (clear text) without html tags. I tried using \[code\]htmlspecialchars(json_encode($posts))\[/code\] and \[code\]strip_tags($posts);\[/code\] but not able to remove html tags from the JSON.Not sure if i am placing it properly as i am new to php. \[code\]public function get_category_posts() {global $json_api;$category = $json_api->introspector->get_current_category();if (!$category) { $json_api->error("Not found.");}$posts = $json_api->introspector->get_posts(array( 'cat' => $category->id));$result = strip_tags($posts);return $this->posts_object_result($result, $category);}\[/code\]JSON:\[code\]"posts": [{ "id": 3454, "type": "post", "status": "publish", "title": "XYZ JOINS", "content": "<p>This is the content that should not have html tags.<\/p>\n", "date": "2012-05-16 22:06:55"}]\[/code\]I want to remove \[code\]<p></p>\[/code\] html tags from above json. There many div and other html tags in the content.