Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Treeverse LakeFS Java SDK JSON

From Leeroopedia


Knowledge Sources
Domains Java_SDK, REST_API
Last Updated 2026-02-08 00:00 GMT

Overview

Concrete tool for Gson-based JSON serialization and deserialization of lakeFS API model objects provided by the lakeFS Java SDK.

Description

The JSON class is an auto-generated Java utility for JSON processing in the lakeFS SDK. It is generated by OpenAPI Generator from the lakeFS OpenAPI specification and manages Gson instance creation, custom type adapter registration for date/time types (ISO 8601), byte arrays, SQL dates, and discriminator-based polymorphic deserialization of model objects.

Usage

This class is used internally by the SDK whenever API requests are serialized or responses are deserialized. It is transparent to SDK users but critical for correct data exchange between Java model objects and JSON payloads.

Code Reference

Source Location

Signature

public class JSON {
    private static Gson gson;
    private static boolean isLenientOnJson = false;
    private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter();
    private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter();
    private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter();
    private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter();
    private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter();

    public static GsonBuilder createGson() { ... }
    public static Gson getGson() { ... }
    // Type adapter inner classes...
}

Import

import io.lakefs.clients.sdk.JSON;

I/O Contract

Inputs

Name Type Required Description
json String Yes Raw JSON string from lakeFS API response
object Object Yes Java model object to serialize to JSON

Outputs

Name Type Description
Gson instance Gson Configured Gson serializer/deserializer for all lakeFS model types

Usage Examples

Basic Usage

import io.lakefs.clients.sdk.JSON;
import com.google.gson.Gson;

// Get the pre-configured Gson instance
Gson gson = JSON.getGson();

// Serialize a model object
String jsonString = gson.toJson(modelObject);

// Deserialize a JSON response
ModelClass result = gson.fromJson(jsonString, ModelClass.class);

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment