EE 1
EE 2
JSON Encode

Developer

Noble Studios

3rd Party (Free)

82 downloads (last 90 days)

GNU General Public License v3 Download v1.0

Compatibility

If an item is crossed out, it might be untested, not applicable or incompatible. Contact the developer to be sure.

Requirements

  • jQuery for the Control Panel

Add-On Type(s)

Plugin

Tags

Provides proper JSON encoding using a template tag.

This plugin encapsulates PHP’s json_encode function.  This is very useful when making JSON feed templates.  Instead of escaping quotes using a text replacement plugin, we can now use the proper json_encode function to get the JSON encoded value of any string.

Let’s say we are making a feed that contains the 10 most recent blog posts.  Our template would look like:


{
	"posts": [
	{exp:channel:entries channel="blog" status="open" dynamic="no" limit="10" orderby="date" sort="desc" show_future_entries="no" }
		{ "title": {exp:json_encode}{title}{/exp:json_encode}, "summary": {exp:json_encode}{summary}{/exp:json_encode}, "page_url": "{page_url}" }{if count<absolute_results}, {/if}
	{/exp:channel:entries}
	]
}

Optionally, one may set the options parameter of json_encode as follows:


{exp:json_encode options="JSON_UNESCAPED_UNICODE"}{title}{/exp:json_encode}

Download JSON Encode

EE Support Downloads Add-On Version Release Date
Not Specified Download 1.0 2013-02-06 03:17 PM

JSON Encode Links

This entry was created February 7, 2013, 10:15 am.
This entry was last updated February 7, 2013, 10:17 am.

Disclaimer: Information about ExpressionEngine add-ons is provided as a service to you, the user, and every member of the ExpressionEngine community. devot:ee is not responsible if you hose, mangle, wreck, or otherwise destroy your EE website by installing an add-on that you found out about at this site, regardless of its rating, Favorites status, commercial or free status, or general popularity. Caveat EEmptor!

3 Reviews:

Steven Grant 07.22.14

Rating - {addon_rating_average}

Did just the job. Wanted to give Solr search a JSON feed of our EE articles. Nailed it!!!

MikeMc 07.31.13

MikeMc
Rating - {addon_rating_average}

Works Fantastic, I spent too much time trying to figure out how to get Low_Rplace to remove extra white space - this is so much cleaner for my code.  THANK YOU!

ometiclan 02.10.13

Rating - {addon_rating_average}

Works great. Using it to exchange data cross-domain with other sites wrapping the output as JSONP. :)