Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

The WRITE-AS-JSON-OBJECT directive composes a JSON object based on the fields specified and writes it to the destination column.

Syntax

 

The column will contain a JSON object composed of all the fields specified in the col.

write-as-json-object :column [col [ ,col]*]

Usage Notes

The WRITE-AS-JSON-OBJECT directive composes a JSON Object based on the fields or columns specified to be added to the object.

Depending on the type of object a field is holding, it will be transformed appropriately to the JSON types. NULL are also handled and converted to JsonNull.

Example

Using this record as an example:

{
  "number": 1,
  "text": "this, is a string.",
  "height" : 1.5,
  "weight" : 1.67,
  "address" : null
}

And applying this directive:

write-as-json-object body number,text,height,address

would result in this record:

{
  "body": { "number":1, "text": "this, is a string.", "height" : 1.5, "address" : null },
  "number": 1,
  "text": "this, is a string.",
  "height" : 1.5,
  "weight" : 1.67,
  "address" : null
}

  • No labels