Skip to content

bigfunctions > json2xml

json2xml

Signature

json2xml(json)

Description

Returns XML for given JSON string

Examples

1. With valid JSON

select bigfunctions.eu.json2xml('{"a": {"b": "foo"}}')
select bigfunctions.us.json2xml('{"a": {"b": "foo"}}')
select bigfunctions.europe_west1.json2xml('{"a": {"b": "foo"}}')
+-------------------+
| xml               |
+-------------------+
| <a><b>foo</b></a> |
+-------------------+

2. With valid JSON and with one key that has empty string as a value

select bigfunctions.eu.json2xml('{"a": ""}')
select bigfunctions.us.json2xml('{"a": ""}')
select bigfunctions.europe_west1.json2xml('{"a": ""}')
+---------+
| xml     |
+---------+
| <a></a> |
+---------+

3. With invalid JSON

select bigfunctions.eu.json2xml('{"a": ""')
select bigfunctions.us.json2xml('{"a": ""')
select bigfunctions.europe_west1.json2xml('{"a": ""')
+------+
| xml  |
+------+
| null |
+------+