json_encode

The WordPress Core json encode function.

Description

json_encode(); 

Usage

  1. if ( !function_exists( 'json_encode' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/noop.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = json_encode(); 
  7.  

Defined (2)

The function is defined in the following location(s).

/wp-admin/includes/noop.php  
  1. function json_encode() {} 
/wp-includes/compat.php  
  1. function json_encode( $string ) { 
  2. global $wp_json; 
  3.  
  4. if ( ! ( $wp_json instanceof Services_JSON ) ) { 
  5. require_once( ABSPATH . WPINC . '/class-json.php' ); 
  6. $wp_json = new Services_JSON(); 
  7.  
  8. return $wp_json->encodeUnsafe( $string );