public class JSON
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
JSON.Mode
JSON files in single-line or multi-line mode.
|
| Constructor and Description |
|---|
JSON()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
JSON |
charset(java.nio.charset.Charset charset)
Sets the charset.
|
smile.data.type.StructType |
inferSchema(java.io.BufferedReader reader,
int limit)
Infer the schema from the top n objects.
|
JSON |
mode(JSON.Mode mode)
Reads JSON files in single-line or multi-line mode.
|
smile.data.DataFrame |
read(java.io.BufferedReader reader,
int limit)
Reads a limited number of records from a JSON file.
|
smile.data.DataFrame |
read(java.nio.file.Path path)
Reads a JSON file.
|
smile.data.DataFrame |
read(java.nio.file.Path path,
int limit)
Reads a JSON file.
|
smile.data.DataFrame |
read(java.lang.String path)
Reads a JSON file.
|
smile.data.DataFrame |
read(java.lang.String path,
int limit)
Reads a JSON file.
|
JSON |
schema(smile.data.type.StructType schema)
Sets the schema.
|
public JSON schema(smile.data.type.StructType schema)
schema - the schema of file.public JSON charset(java.nio.charset.Charset charset)
charset - the charset of file.public smile.data.DataFrame read(java.nio.file.Path path)
throws java.io.IOException
path - a JSON file path.java.io.IOExceptionpublic smile.data.DataFrame read(java.nio.file.Path path,
int limit)
throws java.io.IOException
path - a JSON file path.limit - reads a limited number of records.java.io.IOExceptionpublic smile.data.DataFrame read(java.lang.String path)
throws java.io.IOException,
java.net.URISyntaxException
path - a JSON file path or URI.java.io.IOExceptionjava.net.URISyntaxExceptionpublic smile.data.DataFrame read(java.lang.String path,
int limit)
throws java.io.IOException,
java.net.URISyntaxException
path - a JSON file path or URI.limit - reads a limited number of records.java.io.IOExceptionjava.net.URISyntaxExceptionpublic smile.data.DataFrame read(java.io.BufferedReader reader,
int limit)
throws java.io.IOException
reader - a JSON file reader.limit - reads a limited number of records.java.io.IOExceptionpublic smile.data.type.StructType inferSchema(java.io.BufferedReader reader,
int limit)
throws java.io.IOException
java.io.IOException