Introducción a Zend Framework

 Aprendiendo Zend Framework

Apéndice

 Referencia de Zend Framework


  • 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
  • Traducción al 26.9% - Actualizado el 2011-11-16 - Revisión 24249 - Versión ZF 1.11.x

    39.2. Uso Básico

    El uso de Zend_Json consiste en utilizar los dos métodos públicos estáticos disponibles: Zend_Json::encode() y Zend_Json::decode() .

    // Recuperar un valor:
    $phpNative Zend_Json::decode($encodedValue);

    // Codificarlo para regresarlo al cliente:
    $json Zend_Json::encode($phpNative);

    39.2.1. 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() .

    // Encode it to return to the client:
    $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.

    digg delicious meneame google twitter technorati facebook

    Comentarios

    Loading...