{"id":1250,"date":"2009-05-07T23:09:44","date_gmt":"2009-05-07T21:09:44","guid":{"rendered":"http:\/\/planetozh.com\/blog\/?p=1250"},"modified":"2009-05-07T23:26:37","modified_gmt":"2009-05-07T21:26:37","slug":"encoding-json-with-wordpress","status":"publish","type":"post","link":"https:\/\/planetozh.com\/blog\/2009\/05\/encoding-json-with-wordpress\/","title":{"rendered":"Encoding JSON with WordPress"},"content":{"rendered":"<p>Encoding an array to JSON is dead easy on PHP 5.2+: you just use PHP&#39;s function <tt>json_encode()<\/tt>. The thing is, WordPress has pretty loose requirements and is designed to run on older PHP builds. For those, you need a third party library that will encode to (and decode from, if you need) JSON.<\/p>\n<p>The cool news is that you don&#39;t have to bother searching for such a reliable library: WordPress comes with its own. Just <tt>include()<\/tt> the file located at <tt>\/wp-includes\/js\/tinymce\/plugins\/spellchecker\/classes\/utils\/JSON.php<\/tt> and you&#39;re good.<\/p>\n<p>Check more details and examples on <a href=\"http:\/\/blog.kapish.co.in\/2009\/03\/17\/json-and-wordpress\/\">KAPISH<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Encoding an array to JSON is dead easy on PHP 5.2+: you just use PHP&#39;s function json_encode(). The thing is, WordPress has pretty loose requirements and is designed to run on older PHP builds. For those, you need a third party library that will encode to (and decode from, if you need) JSON. The cool [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[355,245],"class_list":["post-1250","post","type-post","status-publish","format-standard","hentry","category-published","tag-json","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts\/1250","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/comments?post=1250"}],"version-history":[{"count":0,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/posts\/1250\/revisions"}],"wp:attachment":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/media?parent=1250"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/categories?post=1250"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/tags?post=1250"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}