Class JsonUtils
Object
io.delta.kernel.defaults.internal.json.JsonUtils
Utilities method to serialize and deserialize
Row objects with a limited set of data type
values.
Following are the supported data types: boolean, byte, short,
int, long, float, double, string, StructType (containing
any of the supported subtypes), ArrayType, MapType (only a map with string keys
is supported).
At a high-level, the JSON serialization is similar to that of Jackson's ObjectMapper.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic io.delta.kernel.data.RowrowFromJson(String json, io.delta.kernel.types.StructType schema) Converts a JSON string to aRow.static StringrowToJson(io.delta.kernel.data.Row row) Converts aRowto a single line JSON string.
-
Method Details
-
rowToJson
Converts aRowto a single line JSON string. This is currently used just in tests. Wll be used as part of the refactoring planned in #2929- Parameters:
row- the row to convert- Returns:
- JSON string
-
rowFromJson
public static io.delta.kernel.data.Row rowFromJson(String json, io.delta.kernel.types.StructType schema) Converts a JSON string to aRow.- Parameters:
json- JSON stringschema- to read the JSON according the schema- Returns:
Rowinstance with given schema.
-