PHP ETL
  • Introduction
  • Getting Started
  • Extractors
    • Collection
    • CSV
    • Fixed Width
    • JSON
    • Query
    • Table
    • XML
  • Transformers
    • Convert Case
    • JSON Decode
    • JSON Encode
    • Rename Columns
    • Trim
    • Unique Rows
  • Loaders
    • Insert
    • Insert/Update
  • Helpers
  • Running Processes
Powered by GitBook
On this page
  • Options
  • Columns
  • Options
  • Depth
  1. Transformers

JSON Encode

PreviousJSON DecodeNextRename Columns

Last updated 6 years ago

Converts a value into its JSON representation.

$etl->transform('json_encode', $options);

Options

Columns

Columns that will be transformed. If empty, the transformation is applied to all columns.

Type

Default value

array

[]

$options = ['columns' => ['preferences']];

Options

Bitmask consisting of JSON_HEX_QUOT, JSON_HEX_TAG, JSON_HEX_AMP, JSON_HEX_APOS, JSON_NUMERIC_CHECK, JSON_PRETTY_PRINT, JSON_UNESCAPED_SLASHES, JSON_FORCE_OBJECT, JSON_PRESERVE_ZERO_FRACTION, JSON_UNESCAPED_UNICODE, JSON_PARTIAL_OUTPUT_ON_ERROR. The behaviour of these constants is described on the page.

Type

Default value

int

0

$options = ['options' => JSON_FORCE_OBJECT];

Depth

The maximum depth. Must be greater than zero.

Type

Default value

int

512

$options = ['depth' => 32];
JSON constants