Programmer's Reference Guide
基本的な使用法
Zend_Json を使用するために、
静的な publicメソッドが 2 つ公開されています。
名前は Zend_Json::encode() および
Zend_Json::decode() となります。
// 値を取得します
$phpNative = Zend_Json::decode ( $encodedValue ) ;
// クライアントに返すために、それをエンコードします
$json = Zend_Json::encode ( $phpNative ) ;
Pretty-printing JSON
Sometimes, it may be hard to explore JSON data generated by
Zend_Json::encode() ,
since it has no spacing or indentation. In order to make it easier, Zend_Json
allows you to pretty-print JSON data in the human-readable format
with Zend_Json::prettyPrint() .
// クライアントに返すために、それをエンコードします
$json = Zend_Json::encode ( $phpNative ) ;
if ( $debug ) {
echo Zend_Json::
prettyPrint ( $json ,
array ( "indent" =>
" " ) ) ;
}
Second optional argument of Zend_Json::prettyPrint() is an option array.
Option indent allows to set indentation string - by default it's a single tab character.
Please enable JavaScript to view the comments powered by Disqus.
blog comments powered by
Select a Version
1.11
1.10
1.9
1.8
1.7
1.6
1.5
1.0
Languages Available
Deutsch English Français 日本語 Русский 简体中文
Components
Select a component
Zend_Acl
Zend_Amf
Zend_Application
Zend_Auth
Zend_Barcode
Zend_Cache
Zend_Captcha
SimpleCloud API: Zend_Cloud
Zend_CodeGenerator
Zend_Config
Zend_Config_Writer
Zend_Console_Getopt
Zend_Controller
Zend_Currency
Zend_Date
Zend_Db
Zend_Debug
Zend_Dojo
Zend_Dom
Zend_Exception
Zend_Feed
Zend_File
Zend_Filter
Zend_Form
Zend_Gdata
Zend_Http
Zend_InfoCard
Zend_Json
Zend_Layout
Zend_Ldap
Zend_Loader
Zend_Locale
Zend_Log
Zend_Mail
Zend_Markup
Zend_Measure
Zend_Memory
Zend_Mime
Zend_Navigation
Zend_Oauth
Zend_OpenId
Zend_Paginator
Zend_Pdf
Zend_ProgressBar
Zend_Queue
Zend_Reflection
Zend_Registry
Zend_Rest
Zend_Search_Lucene
Zend_Serializer
Zend_Server
Zend_Service
Zend_Session
Zend_Soap
Zend_Tag
Zend_Test
Zend_Text
Zend_TimeSync
Zend_Tool
Zend_Tool_Framework
Zend_Tool_Project
Zend_Translate
Zend_Uri
Zend_Validate
Zend_Version
Zend_View
Zend_Wildfire
Zend_XmlRpc
ZendX_Console_Process_Unix
ZendX_JQuery