Supported in: Batch, Streaming
Parses json strings following the given schema definition, ignoring any fields not in the schema.
Expression categories: Data preparation, File, Popular, Struct
Output type: Array<AnyType> | Map<String, String> | Struct
Argument values:
json
json | Output |
---|---|
{ "airline": "XB-112", "airport": { "id": "JFK", "miles": 2000 } } | { airline: XB-112, airport: { id: JFK, miles: 2000, }, } |
Description: When a requested field is missing in the input JSON the field becomes null. Argument values:
json
json | Output |
---|---|
{ "airline": "XB-112", "airport": { "id": "JFK" } } | { airline: XB-112, airport: { id: JFK, miles: null, }, } |
Description: When a requested field is null in the input JSON the field becomes null. Argument values:
json
json | Output |
---|---|
{ "airline": "XB-112", "airport": { "id": "JFK", "miles": null } } | { airline: XB-112, airport: { id: JFK, miles: null, }, } |
Description: Test field of struct being an array. Argument values:
json
json | Output |
---|---|
{ "airline": "XB-112", "airport": { "id": "JFK", "countries": ["USA", "Canada"] } } | { airline: XB-112, airport: { countries: [ USA, Canada ], id: JFK, }, } |
Description: Test field of struct being empty string. Argument values:
json
json | Output |
---|---|
{ "airline": "XB-112", "airport": { "id": "", "countries": ["USA", "Canada"] } } | { airline: XB-112, airport: { countries: [ USA, Canada ], id: empty string, }, } |
Description: Test field of struct being an array with null element. Argument values:
json
json | Output |
---|---|
{ "airline": "XB-112", "airport": { "id": "JFK", "countries": ["USA", null] } } | { airline: XB-112, airport: { countries: [ USA, null ], id: JFK, }, } |
Description: Test field of struct being a null string. Argument values:
json
json | Output |
---|---|
{ "airline": "XB-112", "airport": { "id": null, "countries": ["USA", "Canada"] } } | { airline: XB-112, airport: { countries: [ USA, Canada ], id: null, }, } |
Description: Test struct with one field being a map. Argument values:
json
json | Output |
---|---|
{ "airline": "XB-112", "airport": { "id": "JFK", "countries": {"USA": 4} } } | { airline: XB-112, airport: { countries: { USA -> 4, }, id: JFK, }, } |
Description: Parse struct with double field. Argument values:
json
json | Output |
---|---|
{ "airline": "XB-112", "airport": { "id": "JFK", "miles": 4.2 } } | { airline: XB-112, airport: { id: JFK, miles: 4.2, }, } |
Description: Ints parsed as doubles should return doubles. Argument values:
json
json | Output |
---|---|
{ "airline": "XB-112", "airport": { "id": "JFK", "miles": 4 } } | { airline: XB-112, airport: { id: JFK, miles: 4.0, }, } |
Description: When a map has a null value, the resultant struct will have a null value. Argument values:
json
json | Output |
---|---|
{ "airline": "XB-112", "airport": { "id": "JFK", "countries": {"USA": null} } } | { airline: XB-112, airport: { countries: { USA -> null, }, id: JFK, }, } |