php/WP_CLI/Formatter.php
public function transform_item_values_to_json( $item ) {
		foreach ( $this->args['fields'] as $field ) {
			$true_field = $this->find_item_key( $item, $field );
			$value      = is_object( $item ) ? $item->$true_field : $item[ $true_field ];
			if ( is_array( $value ) || is_object( $value ) ) {
				if ( is_object( $item ) ) {
					$item->$true_field = json_encode( $value );
				} elseif ( is_array( $item ) ) {
					$item[ $true_field ] = json_encode( $value );
				}
			}
		}
		return $item;
	}
public function transform_item_values_to_json( $item ) {
		foreach ( $this->args['fields'] as $field ) {
			$true_field = $this->find_item_key( $item, $field );
			$value      = is_object( $item ) ? $item->$true_field : $item[ $true_field ];
			if ( is_array( $value ) || is_object( $value ) ) {
				if ( is_object( $item ) ) {
					$item->$true_field = json_encode( $value );
				} elseif ( is_array( $item ) ) {
					$item[ $true_field ] = json_encode( $value );
				}
			}
		}
		return $item;
	}
public function transform_item_values_to_json ( $ item ) { foreach ( $ this -> args [ 'fields' ] as $ field ) { $ true_field = $ this -> find_item_key ( $ item , $ field ) ; $ value = is_object ( $ item ) ? $ item -> $ true_field : $ item [ $ true_field ] ; if ( is_array ( $ value ) || is_object ( $ value ) ) { if ( is_object ( $ item ) ) { $ item -> $ true_field = json_encode ( $ value ) ; } elseif ( is_array ( $ item ) ) { $ item [ $ true_field ] = json_encode ( $ value ) ; } } } return $ item ; }
Transforms objects and arrays to JSON as necessary

@param mixed $item
@return mixed
Transforms objects and arrays to JSON as necessary