BaşlayınÜcretsiz Başlayın

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.

Bu egzersiz

Importing Data in Java

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • 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.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

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));
    }
}
Kodu Düzenle ve Çalıştır