Member-only story
Json to Parquet in Java
Using Java to convert Json into Parquet format.
There are many solutions to convert Json to parquet in Python and you can find many code examples. In Java, there are Apache packages to help with this.
I will use net.minidev.json and org.apache.avro and org.apache.parquet libraries in the sample code.

In high-level, Json to Parquet conversion will be like
- Define the schema
- Load the JSON file and store it as GenericRecord
- Create the Parquet writer
- Write the record
Before getting into the actual code, let’s see the package groups used in the sample.
net.minidev.json vs org.json
org.json is easier to read and use. JsonObject is immutable and supports the pretty print of JsonObject and JsonArray.
import org.json.*;
public class JSONPrettyPrintTest {
public static void main(String args[]) throws JSONException {
String json = "{" +
"Name : Jai," +
"Age : 25, " +
"Salary: 25000.00 " +
"}";
JSONObject jsonObj = new JSONObject(json);
System.out.println("Pretty Print of JSON:")…