Skip to main content

JsonToTable

This Script is part of the Common Scripts Pack.#

Supported versions

Supported Cortex XSOAR versions: 5.5.0 and later.

Accepts a json object and returns a markdown.

Script Data#


NameDescription
Script Typepython3
Tagstransformer, entirelist, general
Cortex XSOAR Version5.5.0

Inputs#


Argument NameDescription
valueThe json to transform to a markdown table.
titleThe markdown title.
headersA comma-separated list of table header values. Default will include all available table headers.
is_auto_json_transformTry to auto json transform.
json_transform_propertiesA json to transform the value to strings. The syntax is: `{"header_key": {"keys": [<item1>, ...], "is_nested": true/false}}`

Outputs#


There are no outputs for this script.

Script Examples#

Example command#

``!JsonToTable value=[{"name": "name1", "value": "val1"}, {"name": "name2", "value" : "val2"}]````

Context Example#

{}

Human Readable Output#

namevalue
name1val1
name2val2

Example command#

!JsonToTable value=`[{"name": "name1", "value": "val1"}, {"name": "name2", "value" : "val2"}]` headers=name

Context Example#

{}

Human Readable Output#

name
name1
name2

Example command#

!JsonToTable value=`[{"name": {"first": "a", "second": "b", "not_important": "no"}, "value": "val1"}, {"name": {"first": "c", "second": "d", "not_important": "no"}, "value": "val2"}]` is_auto_json_transform=true

Context Example#

{}

Human Readable Output#

namevalue

first: a
second: b
not_important: no
val1

first: c
second: d
not_important: no
val2

Example command#

``!JsonToTable value=[{"name": {"first": "a", "second": "b", "not_important": "no"}, "value": "val1"}, {"name": {"first": "c", "second": "d", "not_important": "no"}, "value": "val2"}] json_transform_properties={"name": {"keys": ["first", "second"]}}````

Context Example#

{}

Human Readable Output#

namevalue

first: a
second: b
val1

first: c
second: d
val2

Example command#

``!JsonToTable value=[{"name": {"first": {"a": "val"}, "second": "b", "not_important": "no"}, "value": "val1"}, {"name": {"first": {"a": "val2"}, "second": "d", "not_important": "no"}, "value": "val2"}] json_transform_properties={"name": {"keys": ["a", "second"], "is_nested": "true"}}````

Context Example#

{}

Human Readable Output#

namevalue
first:
a: val

second: b
val1
first:
a: val2

second: d
val2