1.0 - 8.00 - JSONParser Example 4: ERROR_HANDLER - Teradata Vantage

Teradata® Vantage Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.0
8.00
Release Date
May 2019
Content Type
Programming Reference
Publication ID
B700-4003-098K
Language
English (United States)

Input

The input table, json_parser_data_3, is the same as json_parser_data in JSONParser Example 1: Nondefault Values, except for a formatting error: The data column is missing a closing quotation mark and a colon after the menuitem field.

json_parser_data_3
id data
1
{"menu": {
  "id": "1",
  "value": "File",
  "popup": {
    "menuitem [
      {"value": "New", "onclick": "CreateNewDoc()"},
      {"value": "Open", "onclick": "OpenDoc()"},
      {"value": "Close", "onclick": "CloseDoc()"}
    ]
  }
}}

SQL Call

SELECT * FROM JSONParser (
  ON json_parser_data_3
  USING
  TextColumn ('data1')
  Nodes ('menuitem/value')
  ErrorHandler ('true; data1')
) AS dt ORDER BY 1, 2;

Output

out_nodeid out_parent_node menuitem:value ERROR_HANDLER
0    
{"menu": {
"id": "1",
"value": "File",
"popup": { "menuitem [
{"value": "New", "onclick": "CreateNewDoc()"},
{"value": "Open", "onclick": "OpenDoc()"},
{"value": "Close", "onclick": "CloseDoc()"}
]
}
}};