LoslegenKostenlos loslegen

Loading JSON files

You've just joined an e-commerce analytics team, and your first task is to explore the company's product catalog. The data arrives as a JSON file - a format you'll encounter frequently when working with web APIs and modern data sources.

Before diving into analysis, you need to load the JSON data and understand its structure. The JsonReader, JsonReadOptions, and Table classes have been imported for you.

Diese Übung ist Teil des Kurses

Importing Data in Java

Kurs anzeigen

Anleitung zur Übung

  • Configure and build the JSON read options for the file.
  • Create a JsonReader and load the data into a table.
  • Display the first three rows of the table.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

public class UnderstandingJSON {
    public static void main(String[] args) {
        // Configure and build JSON read options
        JsonReadOptions options = ____.builder("products.json").____();
        // Create JsonReader and load data
        Table products = new ____().read(____);

        System.out.println("Product Catalog Structure:");
        System.out.println("Columns: " + products.columnNames());
        System.out.println("Row count: " + products.rowCount());
        System.out.println("\nTable structure:");
        System.out.println(products.structure());
        // Display first three rows
        System.out.println("\nFirst few rows:");
        System.out.println(products.____(3));
    }
}
Code bearbeiten und ausführen