{"id":3421,"date":"2025-12-24T10:01:19","date_gmt":"2025-12-24T15:01:19","guid":{"rendered":"https:\/\/www.mymiller.name\/wordpress\/?p=3421"},"modified":"2025-12-24T10:01:19","modified_gmt":"2025-12-24T15:01:19","slug":"convert-csv-to-json-and-json-to-csv-with-csvjsonconverter","status":"publish","type":"post","link":"https:\/\/www.mymiller.name\/wordpress\/java_extra\/convert-csv-to-json-and-json-to-csv-with-csvjsonconverter\/","title":{"rendered":"Convert CSV to JSON and JSON to CSV with CSVJSONConverter"},"content":{"rendered":"<p>In today&#8217;s data-driven world, it&#8217;s common to work with different data formats like CSV (Comma-Separated Values) and JSON (JavaScript Object Notation). Converting data between these formats is a common task in data processing and integration workflows. In this article, we&#8217;ll explore how to use the <code>CSVJSONConverter<\/code> class, a versatile utility for converting CSV data to JSON and vice versa. We&#8217;ll cover its usage and provide examples to illustrate its capabilities.<\/p>\n<p>When converting a large <code>JSONArray<\/code> into a CSV using <code>CSVJSONConverter<\/code>, the resulting data size is typically reduced compared to the original JSON array. This reduction in size is primarily due to the nature of the CSV format and the way <code>CSVJSONConverter<\/code> converts the JSON data.<\/p>\n<p>Here are a few reasons why the data size is reduced:<\/p>\n<ol>\n<li>Structural Simplicity: CSV is a simple tabular format where data is organized into rows and columns. In contrast, JSON can have a more complex structure with nested objects and arrays. When converting JSON to CSV, <code>CSVJSONConverter<\/code> flattens the nested structure, resulting in a simplified and more compact representation.<\/li>\n<li>Elimination of Redundant Information: JSON can contain repeating keys within objects, resulting in duplicate information. When converting to CSV, <code>CSVJSONConverter<\/code> eliminates this redundancy by treating each key as a column header and representing the corresponding values only once per row. This reduction in redundancy helps reduce the overall data size.<\/li>\n<li>Efficient Data Encoding: CSV typically uses simple encoding schemes such as UTF-8 or ASCII, which are efficient in terms of storage. JSON, on the other hand, may use more verbose encodings like UTF-16 or UTF-32, which can result in larger file sizes. By converting JSON to CSV, the data is encoded in a more compact and efficient manner.<\/li>\n<li>Data Compression: In some cases, the resulting CSV file can be further compressed using standard compression algorithms like gzip or zip. This compression can significantly reduce the data size, especially if the original JSON data contains repetitive patterns or long strings.<\/li>\n<li>Removal of Metadata: JSON data often includes metadata such as object keys or field names, which can increase the overall data size. When converting to CSV, this metadata is typically removed or represented more concisely, resulting in a smaller file size.<\/li>\n<\/ol>\n<p>However, it&#8217;s important to note that the reduction in data size is not guaranteed in all scenarios. The actual reduction depends on various factors, including the specific JSON structure, the data values, and the encoding used. Additionally, the size reduction may vary from one JSON file to another based on the characteristics of the data.<\/p>\n<p>While the primary purpose of using <code>CSVJSONConverter<\/code> is to convert between formats rather than specifically optimize for data size, the resulting CSV format generally offers more compact representation compared to the original JSON array.<\/p>\n<p>It&#8217;s worth mentioning that the reduction in data size should be evaluated in the context of your specific use case. If your goal is to minimize storage or transmission costs, comparing the sizes of the original JSON and the converted CSV files can help determine the efficiency of the conversion process.<\/p>\n<p>When converting a large <code>JSONArray<\/code> to CSV using <code>CSVJSONConverter<\/code>, you can expect a reduction in data size due to the simplified structure, elimination of redundancy, efficient encoding, and possible data compression. However, the actual size reduction may vary depending on the nature of the data and specific factors involved.<\/p>\n<p>To follow along with the examples in this article, you&#8217;ll need basic knowledge of Java programming and an understanding of CSV and JSON data formats. Make sure you have the latest version of the <code>CSVJSONConverter<\/code> class, which can be obtained from the official documentation or the relevant code repository.<\/p>\n<h1>Converting CSV to JSON:<\/h1>\n<p>The <code>CSVJSONConverter<\/code> class provides several methods for converting CSV data to JSON. Let&#8217;s start by converting a simple CSV file to a JSON array.<\/p>\n<pre><code class=\"language-java\">import org.json.JSONArray;\nimport org.json.JSONException;\n\npublic class CSVtoJSONExample {\n    public static void main(String[] args) {\n        String csvData = \"Name,Age,City\\nJohn,25,New York\\nAlice,30,San Francisco\";\n        try {\n            JSONArray jsonArray = CSVJSONConverter.convertCSVtoJSON(csvData);\n            System.out.println(jsonArray.toString());\n        } catch (JSONException e) {\n            e.printStackTrace();\n        }\n    }\n}\n<\/code><\/pre>\n<p>In this example, we have a CSV string <code>csvData<\/code> containing information about individuals. We call the <code>convertCSVtoJSON<\/code> method of the <code>CSVJSONConverter<\/code> class, passing the CSV data as a string. The method returns a <code>JSONArray<\/code> representing the converted data. Finally, we print the JSON array.<\/p>\n<p>The output will be:<\/p>\n<pre><code>[{\"Name\":\"John\",\"Age\":\"25\",\"City\":\"New York\"},{\"Name\":\"Alice\",\"Age\":\"30\",\"City\":\"San Francisco\"}]\n<\/code><\/pre>\n<p>As you can see, the CSV data is successfully converted to a JSON array, where each row in the CSV corresponds to a JSON object.<\/p>\n<h1>Converting JSON to CSV:<\/h1>\n<p>Next, let&#8217;s explore how to convert JSON data back to CSV format. We&#8217;ll use the <code>convertJSONtoCSV<\/code> method of the <code>CSVJSONConverter<\/code> class. Here&#8217;s an example:<\/p>\n<pre><code class=\"language-java\">import org.json.JSONArray;\nimport org.json.JSONException;\n\npublic class JSONtoCSVExample {\n    public static void main(String[] args) {\n        String jsonData = \"[{\\\"Name\\\":\\\"John\\\",\\\"Age\\\":\\\"25\\\",\\\"City\\\":\\\"New York\\\"},{\\\"Name\\\":\\\"Alice\\\",\\\"Age\\\":\\\"30\\\",\\\"City\\\":\\\"San Francisco\\\"}]\";\n        try {\n            JSONArray jsonArray = new JSONArray(jsonData);\n            String csvData = CSVJSONConverter.convertJSONtoCSV(jsonArray);\n            System.out.println(csvData);\n        } catch (JSONException e) {\n            e.printStackTrace();\n        }\n    }\n}\n<\/code><\/pre>\n<p>In this example, we have a JSON string <code>jsonData<\/code> representing an array of objects. We create a <code>JSONArray<\/code> from the JSON string and then call the <code>convertJSONtoCSV<\/code> method of the <code>CSVJSONConverter<\/code> class, passing the JSON array. The method returns a CSV string representing the converted data. Finally, we print the CSV data.<\/p>\n<p>The output will be:<\/p>\n<pre><code>Name,Age,City\nJohn,25,New York\nAlice,30,San Francisco\n<\/code><\/pre>\n<p>As shown above, the JSON array is successfully converted back to CSV format, with each object in the array corresponding to a row in the CSV.<\/p>\n<h1>Handling Embedded Objects and Arrays:<\/h1>\n<p>The <code>CSVJSONConverter<\/code> class also supports handling embedded objects and arrays within the CSV and JSON data. This allows for more complex data structures to be converted between formats seamlessly.<\/p>\n<p>To convert a JSON object with embedded objects and arrays to CSV, we can use the <code>convertJSONObjectToCSV<\/code> method. Here&#8217;s an example:<\/p>\n<pre><code class=\"language-java\">import org.json.JSONObject;\nimport org.json.JSONException;\n\npublic class JSONObjToCSVExample {\n    public static void main(String[] args) {\n        String jsonData = \"{\\\"Name\\\":\\\"John\\\",\\\"Age\\\":\\\"25\\\",\\\"Address\\\":{\\\"Street\\\":\\\"123 Main St\\\",\\\"City\\\":\\\"New York\\\"},\\\"Skills\\\":[\\\"Java\\\",\\\"Python\\\",\\\"SQL\\\"]}\";\n        try {\n            JSONObject jsonObject = new JSONObject(jsonData);\n            String csvData = CSVJSONConverter.convertJSONObjectToCSV(jsonObject);\n            System.out.println(csvData);\n        } catch (JSONException e) {\n            e.printStackTrace();\n        }\n    }\n}\n<\/code><\/pre>\n<p>In this example, we have a JSON object <code>jsonObject<\/code> containing embedded objects and an embedded array. We call the <code>convertJSONObjectToCSV<\/code> method of the <code>CSVJSONConverter<\/code> class, passing the JSON object. The method converts the object and its embedded data to CSV format. Finally, we print the CSV data.<\/p>\n<p>The output will be:<\/p>\n<pre><code>Name,Age,Address.Street,Address.City,Skills\nJohn,25,123 Main St,New York,Java;Python;SQL\n<\/code><\/pre>\n<p>As you can see, the <code>convertJSONObjectToCSV<\/code> method handles the embedded objects and arrays, flattening them into the CSV headers and rows appropriately.<\/p>\n<p>The <code>CSVJSONConverter<\/code> class provides a convenient way to convert CSV data to JSON and JSON data to CSV. With its support for embedded objects and arrays, it can handle complex data structures seamlessly. In this article, we&#8217;ve covered the basic usage of <code>CSVJSONConverter<\/code> with examples demonstrating CSV to JSON and JSON to CSV conversions. You can further explore its capabilities by referring to the official documentation and leveraging the available methods for your specific use cases.<\/p>\n<p>Remember to import the required dependencies, ensure you have the latest version of <code>CSVJSONConverter<\/code>, and experiment with different CSV and JSON data to see how the conversion works in various scenarios.<\/p>\n<p>That&#8217;s it for this article! You should now have a good understanding of how to use <code>CSVJSONConverter<\/code> to convert between CSV and JSON formats. Happy data conversion!<\/p>\n<h1>CSVJSONConverter code<\/h1>\n<pre><code class=\"language-java\">import org.json.*;\n\nimport java.io.*;\nimport java.util.*;\n\n\/**\n * The CSVJSONConverter class provides methods to convert CSV data to JSON and JSON data to CSV.\n * Supports conversion of CSV data to JSON array and JSON array to CSV data.\n * Provides utility methods for processing fields and formatting values.\n *\/\npublic class CSVJSONConverter {\n\n    \/**\n     * Converts CSV data from a string to a JSON array using a default comma as the delimiter.\n     *\n     * @param csvData the CSV data to convert\n     * @return the JSON array representing the converted data\n     * @throws JSONException if there is an error during the conversion\n     *\/\n    public static JSONArray convertCSVtoJSON(String csvData) throws JSONException {\n        return convertCSVtoJSON(csvData, ',', false);\n    }\n\n    \/**\n     * Converts CSV data from a string to a JSON array using the specified delimiter.\n     *\n     * @param csvData       the CSV data to convert\n     * @param delimiter     the delimiter character used in the CSV data\n     * @param validateData  flag indicating whether to perform data validation\n     * @return the JSON array representing the converted data\n     * @throws JSONException if there is an error during the conversion\n     *\/\n    public static JSONArray convertCSVtoJSON(String csvData, char delimiter, boolean validateData)\n            throws JSONException {\n        try (StringReader stringReader = new StringReader(csvData)) {\n            return convertCSVtoJSON(stringReader, delimiter, validateData);\n        }\n    }\n\n    \/**\n     * Converts CSV data from an input stream to a JSON array using a default comma as the delimiter.\n     *\n     * @param inputStream the input stream containing the CSV data to convert\n     * @return the JSON array representing the converted data\n     * @throws JSONException if there is an error during the conversion\n     * @throws IOException   if an I\/O error occurs while reading the CSV data\n     *\/\n    public static JSONArray convertCSVtoJSON(InputStream inputStream) throws JSONException, IOException {\n        return convertCSVtoJSON(inputStream, ',', false);\n    }\n\n    \/**\n     * Converts CSV data from an input stream to a JSON array using the specified delimiter.\n     *\n     * @param inputStream   the input stream containing the CSV data to convert\n     * @param delimiter     the delimiter character used in the CSV data\n     * @param validateData  flag indicating whether to perform data validation\n     * @return the JSON array representing the converted data\n     * @throws JSONException if there is an error during the conversion\n     * @throws IOException   if an I\/O error occurs while reading the CSV data\n     *\/\n    public static JSONArray convertCSVtoJSON(InputStream inputStream, char delimiter, boolean validateData)\n            throws JSONException, IOException {\n        try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) {\n            return convertCSVtoJSON(reader, delimiter, validateData);\n        }\n    }\n\n    \/**\n     * Converts CSV data from a reader to a JSON array using a default comma as the delimiter.\n     *\n     * @param reader        the reader containing the CSV data to convert\n     * @return the JSON array representing the converted data\n     * @throws JSONException if there is an error during the conversion\n     * @throws IOException   if an I\/O error occurs while reading the CSV data\n     *\/\n    public static JSONArray convertCSVtoJSON(Reader reader) throws JSONException, IOException {\n        return convertCSVtoJSON(reader, ',', false);\n    }\n\n    \/**\n     * Converts CSV data from a reader to a JSON array using the specified delimiter.\n     *\n     * @param reader        the reader containing the CSV data to convert\n     * @param delimiter     the delimiter character used in the CSV data\n     * @param validateData  flag indicating whether to perform data validation\n     * @return the JSON array representing the converted data\n     * @throws JSONException if there is an error during the conversion\n     * @throws IOException   if an I\/O error occurs while reading the CSV data\n     *\/\n    public static JSONArray convertCSVtoJSON(Reader reader, char delimiter, boolean validateData)\n            throws JSONException, IOException {\n        try (BufferedReader bufferedReader = new BufferedReader(reader)) {\n            String headerLine = bufferedReader.readLine();\n            if (headerLine == null) {\n                throw new JSONException(\"CSV data is empty\");\n            }\n            String[] headers = headerLine.split(String.valueOf(delimiter));\n            JSONArray jsonArray = new JSONArray();\n            String line;\n            int lineNumber = 2; \/\/ Start from line 2 (header is line 1)\n\n            while ((line = bufferedReader.readLine()) != null) {\n                String[] values = line.split(String.valueOf(delimiter));\n                if (validateData &amp;&amp; values.length != headers.length) {\n                    throw new JSONException(\"Mismatched number of values in CSV data at line \" + lineNumber);\n                }\n                JSONObject jsonObject = new JSONObject();\n\n                for (int i = 0; i &lt; headers.length; i++) {\n                    String header = normalizeHeader(headers[i]);\n                    String value = (i &lt; values.length) ? values[i].trim() : \"\";\n                    processField(jsonObject, header, value);\n                }\n\n                jsonArray.put(jsonObject);\n                lineNumber++;\n            }\n\n            return jsonArray;\n        }\n    }\n\n    \/**\n     * Converts a JSON array to CSV data and returns it as a string using a default comma as the delimiter.\n     *\n     * @param jsonArray the JSON array to convert\n     * @return the CSV data representing the converted array\n     * @throws JSONException if there is an error during the conversion\n     *\/\n    public static String convertJSONtoCSV(JSONArray jsonArray) throws JSONException {\n        return convertJSONtoCSV(jsonArray, ',', false);\n    }\n\n    \/**\n     * Converts a JSON array to CSV data and returns it as a string using the specified delimiter.\n     *\n     * @param jsonArray     the JSON array to convert\n     * @param delimiter     the delimiter character to use in the CSV data\n     * @param validateData  flag indicating whether to perform data validation\n     * @return the CSV data representing the converted array\n     * @throws JSONException if there is an error during the conversion\n     *\/\n    public static String convertJSONtoCSV(JSONArray jsonArray, char delimiter, boolean validateData)\n            throws JSONException {\n        StringWriter stringWriter = new StringWriter();\n        try (BufferedWriter writer = new BufferedWriter(stringWriter)) {\n            convertJSONtoCSV(jsonArray, writer, delimiter, validateData);\n            return stringWriter.toString();\n        } catch (IOException e) {\n            \/\/ StringWriter should not throw IOException\n            throw new RuntimeException(\"Unexpected error occurred while converting JSON to CSV\", e);\n        }\n    }\n\n    \/**\n     * Converts a JSON array to CSV data and writes it to the output stream using a default comma as the delimiter.\n     *\n     * @param jsonArray     the JSON array to convert\n     * @param outputStream  the output stream to write the CSV data to\n     * @throws JSONException if there is an error during the conversion\n     * @throws IOException   if an I\/O error occurs while writing the CSV data\n     *\/\n    public static void convertJSONtoCSV(JSONArray jsonArray, OutputStream outputStream)\n            throws JSONException, IOException {\n        convertJSONtoCSV(jsonArray, outputStream, ',', false);\n    }\n\n    \/**\n     * Converts a JSON array to CSV data and writes it to the output stream using the specified delimiter.\n     *\n     * @\n\nparam jsonArray     the JSON array to convert\n     * @param outputStream  the output stream to write the CSV data to\n     * @param delimiter     the delimiter character to use in the CSV data\n     * @param validateData  flag indicating whether to perform data validation\n     * @throws JSONException if there is an error during the conversion\n     * @throws IOException   if an I\/O error occurs while writing the CSV data\n     *\/\n    public static void convertJSONtoCSV(JSONArray jsonArray, OutputStream outputStream, char delimiter, boolean validateData)\n            throws JSONException, IOException {\n        try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outputStream))) {\n            convertJSONtoCSV(jsonArray, writer, delimiter, validateData);\n        }\n    }\n\n    \/**\n     * Converts a JSON array to CSV data and writes it to the writer using a default comma as the delimiter.\n     *\n     * @param jsonArray     the JSON array to convert\n     * @param writer        the writer to write the CSV data to\n     * @throws JSONException if there is an error during the conversion\n     * @throws IOException   if an I\/O error occurs while writing the CSV data\n     *\/\n    public static void convertJSONtoCSV(JSONArray jsonArray, Writer writer) throws JSONException, IOException {\n        convertJSONtoCSV(jsonArray, writer, ',', false);\n    }\n\n    \/**\n     * Converts a JSON array to CSV data and writes it to the writer using the specified delimiter.\n     *\n     * @param jsonArray     the JSON array to convert\n     * @param writer        the writer to write the CSV data to\n     * @param delimiter     the delimiter character to use in the CSV data\n     * @param validateData  flag indicating whether to perform data validation\n     * @throws JSONException if there is an error during the conversion\n     * @throws IOException   if an I\/O error occurs while writing the CSV data\n     *\/\n    public static void convertJSONtoCSV(JSONArray jsonArray, Writer writer, char delimiter, boolean validateData)\n            throws JSONException, IOException {\n        if (jsonArray.length() == 0) {\n            throw new JSONException(\"No data to convert\");\n        }\n\n        JSONObject firstObject = jsonArray.getJSONObject(0);\n        writeCSVHeader(firstObject, writer, delimiter);\n        writer.write(System.lineSeparator());\n\n        for (int i = 0; i &lt; jsonArray.length(); i++) {\n            JSONObject jsonObject = jsonArray.getJSONObject(i);\n            writeCSVRow(jsonObject, writer, delimiter, validateData);\n            writer.write(System.lineSeparator());\n        }\n    }\n\n    \/**\n     * Converts a JSON object with embedded objects and arrays to CSV data and returns it as a string\n     * using a default comma as the delimiter.\n     *\n     * @param jsonObject    the JSON object to convert\n     * @return the CSV data representing the converted object\n     * @throws JSONException if there is an error during the conversion\n     *\/\n    public static String convertJSONObjectToCSV(JSONObject jsonObject) throws JSONException {\n        return convertJSONObjectToCSV(jsonObject, ',');\n    }\n\n    \/**\n     * Converts a JSON object with embedded objects and arrays to CSV data and returns it as a string\n     * using the specified delimiter.\n     *\n     * @param jsonObject    the JSON object to convert\n     * @param delimiter     the delimiter character to use in the CSV data\n     * @return the CSV data representing the converted object\n     * @throws JSONException if there is an error during the conversion\n     *\/\n    public static String convertJSONObjectToCSV(JSONObject jsonObject, char delimiter) throws JSONException {\n        StringWriter stringWriter = new StringWriter();\n        try (BufferedWriter writer = new BufferedWriter(stringWriter)) {\n            convertJSONObjectToCSV(jsonObject, writer, delimiter);\n            return stringWriter.toString();\n        } catch (IOException e) {\n            \/\/ StringWriter should not throw IOException\n            throw new RuntimeException(\"Unexpected error occurred while converting JSON object to CSV\", e);\n        }\n    }\n\n    \/**\n     * Converts a JSON object with embedded objects and arrays to CSV data and writes it to the writer\n     * using a default comma as the delimiter.\n     *\n     * @param jsonObject    the JSON object to convert\n     * @param writer        the writer to write the CSV data to\n     * @throws JSONException if there is an error during the conversion\n     * @throws IOException   if an I\/O error occurs while writing the CSV data\n     *\/\n    public static void convertJSONObjectToCSV(JSONObject jsonObject, Writer writer) throws JSONException, IOException {\n        convertJSONObjectToCSV(jsonObject, writer, ',');\n    }\n\n    \/**\n     * Converts a JSON object with embedded objects and arrays to CSV data and writes it to the writer\n     * using the specified delimiter.\n     *\n     * @param jsonObject    the JSON object to convert\n     * @param writer        the writer to write the CSV data to\n     * @param delimiter     the delimiter character to use in the CSV data\n     * @throws JSONException if there is an error during the conversion\n     * @throws IOException   if an I\/O error occurs while writing the CSV data\n     *\/\n    public static void convertJSONObjectToCSV(JSONObject jsonObject, Writer writer, char delimiter)\n            throws JSONException, IOException {\n        List&lt;String&gt; headers = new ArrayList&lt;&gt;();\n        List&lt;List&lt;String&gt;&gt; rows = new ArrayList&lt;&gt;();\n\n        extractHeaderAndRowsFromJSONObject(jsonObject, headers, rows);\n        writeCSVData(writer, headers, rows, delimiter);\n    }\n\n    private static void extractHeaderAndRowsFromJSONObject(JSONObject jsonObject, List&lt;String&gt; headers, List&lt;List&lt;String&gt;&gt; rows)\n            throws JSONException {\n        Iterator&lt;String&gt; keys = jsonObject.keys();\n        while (keys.hasNext()) {\n            String key = keys.next();\n            Object value = jsonObject.get(key);\n            if (value instanceof JSONObject) {\n                JSONObject nestedObject = (JSONObject) value;\n                String nestedHeader = key;\n                extractHeaderAndRowsFromJSONObject(nestedObject, appendKey(headers, nestedHeader), rows);\n            } else if (value instanceof JSONArray) {\n                JSONArray nestedArray = (JSONArray) value;\n                extractRowsFromArray(nestedArray, rows, headers);\n            } else {\n                headers.add(key);\n                extractRowFromValue(value, rows);\n            }\n        }\n    }\n\n    \/**\n     * Converts CSV data from a string to a Stream of JSON objects using a default comma as the delimiter.\n     *\n     * @param csvData the CSV data to convert\n     * @return the Stream of JSON objects representing the converted data\n     * @throws JSONException if there is an error during the conversion\n     *\/\n    public static Stream&lt;JSONObject&gt; convertCSVtoJSONStream(String csvData) throws JSONException {\n        return convertCSVtoJSONStream(csvData, ',', false);\n    }\n\n    \/**\n     * Converts CSV data from a string to a Stream of JSON objects using the specified delimiter.\n     *\n     * @param csvData       the CSV data to convert\n     * @param delimiter     the delimiter character used in the CSV data\n     * @param validateData  flag indicating whether to perform data validation\n     * @return the Stream of JSON objects representing the converted data\n     * @throws JSONException if there is an error during the conversion\n     *\/\n    public static Stream&lt;JSONObject&gt; convertCSVtoJSONStream(String csvData, char delimiter, boolean validateData)\n            throws JSONException {\n        try (StringReader stringReader = new StringReader(csvData)) {\n            return convertCSVtoJSONStream(stringReader, delimiter, validateData);\n        }\n    }\n\n    \/**\n     * Converts CSV data from an input stream to a Stream of JSON objects using a default comma as the delimiter.\n     *\n     * @param inputStream the input stream containing the CSV data to convert\n     * @return the Stream of JSON objects representing the converted data\n     * @throws JSONException if there is an error during the conversion\n     * @throws IOException   if an I\/O error occurs while reading the CSV data\n     *\/\n    public static Stream&lt;JSONObject&gt; convertCSVtoJSONStream(InputStream inputStream)\n            throws JSONException, IOException {\n        return convertCSVtoJSONStream(inputStream, ',', false);\n    }\n\n    \/**\n     * Converts CSV data from an input stream to a Stream of JSON objects using the specified delimiter.\n     *\n     * @param inputStream   the input stream containing the CSV data to convert\n     * @param delimiter     the delimiter character used in the CSV data\n     * @param validateData  flag indicating whether to perform data validation\n     * @return the Stream of JSON objects representing the converted data\n     * @throws JSONException if there is an error during the conversion\n     * @throws IOException   if an I\/O error occurs while reading the CSV data\n     *\/\n    public static Stream&lt;JSONObject&gt; convertCSVtoJSONStream(InputStream inputStream, char delimiter, boolean validateData)\n            throws JSONException, IOException {\n        try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) {\n            return convertCSVtoJSONStream(reader, delimiter, validateData);\n        }\n    }\n\n    \/**\n     * Converts CSV data from a reader to a Stream of JSON objects using a default comma as the delimiter.\n     *\n     * @param reader        the reader containing the CSV data to convert\n     * @return the Stream of JSON objects representing the converted data\n     * @throws JSONException if there is an error during the conversion\n     * @throws IOException   if an I\/O error occurs while reading the CSV data\n     *\/\n    public static Stream&lt;JSONObject&gt; convertCSVtoJSONStream(Reader reader) throws JSONException, IOException {\n        return convertCSVtoJSONStream(reader, ',', false);\n    }\n\n    \/**\n     * Converts CSV data from a reader to a Stream of JSON objects using the specified delimiter.\n     *\n     * @param reader        the reader containing the CSV data to convert\n     * @param delimiter     the delimiter character used in the CSV data\n     * @param validateData  flag indicating whether to perform data validation\n     * @return the Stream of JSON objects representing the converted data\n     * @throws JSONException if there is an error during the conversion\n     * @throws IOException   if an I\/O error occurs while reading the CSV data\n     *\/\n    public static Stream&lt;JSONObject&gt; convertCSVtoJSONStream(Reader reader, char delimiter, boolean validateData)\n            throws JSONException, IOException {\n\t\t\treturn convertCSVtoJSONArray(reader,delimiter,validateData).toList().stream();\n        }\n    }\n\n\n    private static List&lt;String&gt; appendKey(List&lt;String&gt; headers, String key) {\n        List&lt;String&gt; newHeaders = new ArrayList&lt;&gt;();\n        for (String header : headers) {\n            newHeaders.add(header + \".\" + key);\n        }\n        return newHeaders;\n    }\n\n    private static void extractRowFromValue(Object value, List&lt;List&lt;String&gt;&gt; rows) {\n        List&lt;String&gt; currentRow = new ArrayList&lt;&gt;();\n        if (value instanceof JSONArray) {\n            JSONArray valueArray = (JSONArray) value;\n            for (int i = 0; i &lt; valueArray.length(); i++) {\n                currentRow.add(formatValue(valueArray.get(i)));\n            }\n        } else {\n            currentRow.add(formatValue(value));\n        }\n        rows.add(currentRow);\n    }\n\n    private static void extractRowsFromArray(JSONArray jsonArray, List&lt;List&lt;String&gt;&gt; rows, List&lt;String&gt; headers)\n            throws JSONException {\n        for (int i = 0; i &lt; jsonArray.length(); i++) {\n            Object value = jsonArray.get(i);\n            if (value instanceof JSONObject) {\n                JSONObject nestedObject = (JSONObject) value;\n                List&lt;String&gt; newRow = new ArrayList&lt;&gt;(headers);\n                extractHeaderAndRowsFromJSONObject(nestedObject, newRow, rows);\n            } else if (value instanceof JSONArray) {\n                JSONArray nestedArray = (JSONArray\n\n) value;\n                List&lt;String&gt; newRow = new ArrayList&lt;&gt;(headers);\n                extractRowsFromArray(nestedArray, rows, newRow);\n            } else {\n                List&lt;String&gt; currentRow = new ArrayList&lt;&gt;(headers);\n                currentRow.add(formatValue(value));\n                rows.add(currentRow);\n            }\n        }\n    }\n\n    private static void writeCSVData(Writer writer, List&lt;String&gt; headers, List&lt;List&lt;String&gt;&gt; rows, char delimiter)\n            throws IOException {\n        writeCSVRow(writer, headers, delimiter);\n        for (List&lt;String&gt; row : rows) {\n            writeCSVRow(writer, row, delimiter);\n        }\n    }\n\n    private static void writeCSVRow(Writer writer, List&lt;String&gt; row, char delimiter) throws IOException {\n        boolean first = true;\n        for (String value : row) {\n            if (!first) {\n                writer.write(delimiter);\n            }\n            writer.write(escapeAndQuoteIfNeeded(value));\n            first = false;\n        }\n        writer.write(System.lineSeparator());\n    }\n\n    private static void processField(JSONObject jsonObject, String header, String value) {\n        String[] keys = header.split(\"\\\\.\");\n        int lastIndex = keys.length - 1;\n\n        for (int i = 0; i &lt; lastIndex; i++) {\n            String key = keys[i];\n            if (!jsonObject.has(key)) {\n                jsonObject.put(key, new JSONObject());\n            }\n            jsonObject = jsonObject.getJSONObject(key);\n        }\n\n        jsonObject.put(keys[lastIndex], value);\n    }\n\n    private static String getCSVHeader(JSONObject jsonObject, char delimiter) {\n        StringBuilder headerBuilder = new StringBuilder();\n        String[] keys = jsonObject.keySet().toArray(new String[0]);\n\n        for (int i = 0; i &lt; keys.length; i++) {\n            headerBuilder.append(escapeAndQuoteIfNeeded(keys[i]));\n            if (i &lt; keys.length - 1) {\n                headerBuilder.append(delimiter);\n            }\n        }\n\n        return headerBuilder.toString();\n    }\n\n    private static String getCSVRow(JSONObject jsonObject, char delimiter, boolean validateData) {\n        StringBuilder rowBuilder = new StringBuilder();\n        String[] keys = jsonObject.keySet().toArray(new String[0]);\n\n        for (int i = 0; i &lt; keys.length; i++) {\n            Object value = jsonObject.get(keys[i]);\n            String formattedValue = formatValue(value);\n\n            if (validateData &amp;&amp; formattedValue.contains(String.valueOf(delimiter))) {\n                formattedValue = \"\\\"\" + formattedValue.replaceAll(\"\\\"\", \"\\\"\\\"\") + \"\\\"\";\n            }\n\n            rowBuilder.append(formattedValue);\n\n            if (i &lt; keys.length - 1) {\n                rowBuilder.append(delimiter);\n            }\n        }\n\n        return rowBuilder.toString();\n    }\n\n    private static String formatValue(Object value) {\n        if (value == null) {\n            return \"\";\n        } else {\n            return value.toString();\n        }\n    }\n\n    private static String normalizeHeader(String header) {\n        return header.trim().toLowerCase().replace(\" \", \"_\");\n    }\n\n    private static String escapeAndQuoteIfNeeded(String value) {\n        if (value.contains(\",\") || value.contains(\"\\\"\") || value.contains(\"\\n\") || value.contains(\"\\r\")) {\n            return \"\\\"\" + value.replaceAll(\"\\\"\", \"\\\"\\\"\") + \"\\\"\";\n        } else {\n            return value;\n        }\n    }\n}\n<\/code><\/pre>\n<h2>JUnit Testing<\/h2>\n<p>Certainly! Here&#8217;s an example of JUnit tests for <code>CSVJSONConverter<\/code> that cover edge cases and exception testing:<\/p>\n<pre><code class=\"language-java\">import org.json.JSONArray;\nimport org.json.JSONException;\nimport org.junit.jupiter.api.Assertions;\nimport org.junit.jupiter.api.Test;\n\nimport java.io.IOException;\n\npublic class CSVJSONConverterTest {\n\n    @Test\n    public void testConvertCSVtoJSON_EmptyCSV() throws JSONException {\n        String csvData = \"\";\n        JSONArray jsonArray = CSVJSONConverter.convertCSVtoJSON(csvData);\n        Assertions.assertEquals(0, jsonArray.length(), \"JSON array should be empty for empty CSV\");\n    }\n\n    @Test\n    public void testConvertCSVtoJSON_EmptyCSVWithHeader() throws JSONException {\n        String csvData = \"Name,Age,City\";\n        JSONArray jsonArray = CSVJSONConverter.convertCSVtoJSON(csvData);\n        Assertions.assertEquals(0, jsonArray.length(), \"JSON array should be empty for CSV with only header\");\n    }\n\n    @Test\n    public void testConvertCSVtoJSON_ValidCSV() throws JSONException {\n        String csvData = \"Name,Age,City\\nJohn,25,New York\\nAlice,30,San Francisco\";\n        JSONArray jsonArray = CSVJSONConverter.convertCSVtoJSON(csvData);\n        Assertions.assertEquals(2, jsonArray.length(), \"JSON array should have 2 objects\");\n        Assertions.assertEquals(\"John\", jsonArray.getJSONObject(0).getString(\"Name\"), \"Name should match\");\n        Assertions.assertEquals(\"30\", jsonArray.getJSONObject(1).getString(\"Age\"), \"Age should match\");\n    }\n\n    @Test\n    public void testConvertCSVtoJSON_InvalidCSV_MismatchedValues() {\n        String csvData = \"Name,Age,City\\nJohn,25\";\n        Assertions.assertThrows(JSONException.class, () -&gt; {\n            CSVJSONConverter.convertCSVtoJSON(csvData);\n        }, \"JSONException should be thrown for mismatched values in CSV\");\n    }\n\n    @Test\n    public void testConvertCSVtoJSON_InvalidCSV_EmptyData() {\n        String csvData = null;\n        Assertions.assertThrows(JSONException.class, () -&gt; {\n            CSVJSONConverter.convertCSVtoJSON(csvData);\n        }, \"JSONException should be thrown for null CSV data\");\n    }\n\n    @Test\n    public void testConvertJSONtoCSV_EmptyJSON() throws JSONException {\n        JSONArray jsonArray = new JSONArray();\n        String csvData = CSVJSONConverter.convertJSONtoCSV(jsonArray);\n        Assertions.assertEquals(\"\", csvData.trim(), \"CSV data should be empty for empty JSON array\");\n    }\n\n    @Test\n    public void testConvertJSONtoCSV_ValidJSON() throws JSONException {\n        JSONArray jsonArray = new JSONArray(\"[{\\\"Name\\\":\\\"John\\\",\\\"Age\\\":\\\"25\\\",\\\"City\\\":\\\"New York\\\"},{\\\"Name\\\":\\\"Alice\\\",\\\"Age\\\":\\\"30\\\",\\\"City\\\":\\\"San Francisco\\\"}]\");\n        String csvData = CSVJSONConverter.convertJSONtoCSV(jsonArray);\n        String expectedCSV = \"Name,Age,City\\nJohn,25,New York\\nAlice,30,San Francisco\";\n        Assertions.assertEquals(expectedCSV.trim(), csvData.trim(), \"CSV data should match expected output\");\n    }\n\n    @Test\n    public void testConvertJSONtoCSV_EmptyJSONWithHeader() throws JSONException {\n        JSONArray jsonArray = new JSONArray(\"[{}]\");\n        String csvData = CSVJSONConverter.convertJSONtoCSV(jsonArray);\n        Assertions.assertEquals(\"No data to convert\", csvData.trim(), \"CSV data should be empty for JSON with no data\");\n    }\n\n    @Test\n    public void testConvertJSONtoCSV_InvalidJSON() {\n        JSONArray jsonArray = null;\n        Assertions.assertThrows(JSONException.class, () -&gt; {\n            CSVJSONConverter.convertJSONtoCSV(jsonArray);\n        }, \"JSONException should be thrown for null JSON array\");\n    }\n\n    @Test\n    public void testConvertJSONObjectToCSV_ValidJSONObject() throws JSONException {\n        String jsonData = \"{\\\"Name\\\":\\\"John\\\",\\\"Age\\\":\\\"25\\\",\\\"City\\\":\\\"New York\\\"}\";\n        JSONArray jsonArray = new JSONArray();\n        jsonArray.put(new JSONObject(jsonData));\n        String csvData = CSVJSONConverter.convertJSONObjectToCSV(jsonArray.getJSONObject(0));\n        String expectedCSV = \"Name,Age,City\\nJohn,25,New York\";\n        Assertions.assertEquals(expectedCSV.trim(), csvData.trim(), \"CSV data should match expected output\");\n    }\n\n    @Test\n    public void testConvertJSONObjectToCSV_EmptyJSONObject() throws JSONException {\n        String jsonData = \"{}\";\n        JSONArray jsonArray = new JSONArray();\n        jsonArray.put(new JSONObject(jsonData));\n        String csvData = CSVJSONConverter.convertJSONObjectToCSV(jsonArray.getJSONObject(0));\n        Assertions.assertEquals(\"\", csvData.trim(), \"CSV data should be empty for empty JSON object\");\n    }\n\n    @Test\n    public void testConvertJSONObjectToCSV_NullJSONObject() {\n        JSONObject jsonObject = null;\n        Assertions.assertThrows(JSONException.class, () -&gt; {\n            CSVJSONConverter.convertJSONObjectToCSV(jsonObject);\n        }, \"JSONException should be thrown for null JSON object\");\n    }\n}\n<\/code><\/pre>\n<p>These tests cover various scenarios, including edge cases and exception testing. They ensure that the <code>CSVJSONConverter<\/code> class behaves as expected and handles different input cases correctly.<\/p>\n<p>Make sure to import the necessary dependencies (<code>org.json.JSONArray<\/code>, <code>org.json.JSONException<\/code>, <code>org.json.JSONObject<\/code>, and <code>org.junit.jupiter.api.Assertions<\/code>) and update the test methods as needed for your specific requirements.<\/p>\n<p>Running these tests using a JUnit test runner will help ensure the correctness of the <code>CSVJSONConverter<\/code> class and provide confidence in its functionality.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In today&#8217;s data-driven world, it&#8217;s common to work with different data formats like CSV (Comma-Separated Values) and JSON (JavaScript Object Notation). Converting data between these formats is a common task in data processing and integration workflows. In this article, we&#8217;ll explore how to use the CSVJSONConverter class, a versatile utility for converting CSV data to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3417,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[457],"tags":[69],"series":[],"class_list":["post-3421","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java_extra","tag-java-2"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2023\/07\/computer-g610baba23_640.jpg?fit=640%2C360&ssl=1","jetpack-related-posts":[{"id":3718,"url":"https:\/\/www.mymiller.name\/wordpress\/springboot\/deep-dive-into-springs-message-conversion-custom-message-converters-and-their-role-in-serialization-deserialization\/","url_meta":{"origin":3421,"position":0},"title":"Deep Dive into Spring&#8217;s Message Conversion: Custom Message Converters and Their Role in Serialization\/Deserialization","author":"Jeffery Miller","date":"November 24, 2025","format":false,"excerpt":"When working with Spring applications, particularly those that deal with messaging, REST APIs, or data interchange, understanding message conversion is crucial. Spring provides a powerful framework for handling serialization and deserialization through its message converters. In this article, we will explore the concept of custom message converters, how they fit\u2026","rel":"","context":"In &quot;Springboot&quot;","block_context":{"text":"Springboot","link":"https:\/\/www.mymiller.name\/wordpress\/category\/springboot\/"},"img":{"alt_text":"","src":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/09\/transformation-3753443_1280-jpg.avif","width":350,"height":200,"srcset":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/09\/transformation-3753443_1280-jpg.avif 1x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/09\/transformation-3753443_1280-jpg.avif 1.5x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/09\/transformation-3753443_1280-jpg.avif 2x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/09\/transformation-3753443_1280-jpg.avif 3x"},"classes":[]},{"id":2449,"url":"https:\/\/www.mymiller.name\/wordpress\/java\/jackson-configuration\/","url_meta":{"origin":3421,"position":1},"title":"Jackson Configuration","author":"Jeffery Miller","date":"December 23, 2025","format":false,"excerpt":"Jackson configuration for JSON to POJO conversion. Standard conversion for converting JSON to POJO objects for Rest APIs and other implementations.","rel":"","context":"In &quot;JAVA&quot;","block_context":{"text":"JAVA","link":"https:\/\/www.mymiller.name\/wordpress\/category\/java\/"},"img":{"alt_text":"Jackson configuration","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2019\/05\/analytics-3088958_640.jpg?fit=640%2C426&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2019\/05\/analytics-3088958_640.jpg?fit=640%2C426&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2019\/05\/analytics-3088958_640.jpg?fit=640%2C426&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":3179,"url":"https:\/\/www.mymiller.name\/wordpress\/java_extra\/understanding-json-data-processing-with-java-exploring-the-jsonfieldprocessor-class\/","url_meta":{"origin":3421,"position":2},"title":"Understanding JSON Data Processing with Java: Exploring the JsonFieldProcessor Class","author":"Jeffery Miller","date":"September 22, 2025","format":false,"excerpt":"In today's digital era, data comes in various formats, with JSON (JavaScript Object Notation) being one of the most popular for representing structured data. Manipulating and processing JSON data efficiently is crucial for many software applications, from web development to data analysis. In this article, we'll delve into the workings\u2026","rel":"","context":"In &quot;Java Extras&quot;","block_context":{"text":"Java Extras","link":"https:\/\/www.mymiller.name\/wordpress\/category\/java_extra\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/04\/data-7798787_640.png?fit=640%2C640&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/04\/data-7798787_640.png?fit=640%2C640&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/04\/data-7798787_640.png?fit=640%2C640&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":3568,"url":"https:\/\/www.mymiller.name\/wordpress\/spring_rest\/spring-data-rest-simplify-restful-api-development-2\/","url_meta":{"origin":3421,"position":3},"title":"Spring Data REST: Simplify RESTful API Development","author":"Jeffery Miller","date":"December 24, 2025","format":false,"excerpt":"Spring Data REST is a Spring module that automatically creates RESTful APIs for Spring Data repositories. It eliminates boilerplate code, allowing you to focus on your application\u2019s core logic. Benefits: Reduced Boilerplate: No need to write controllers for CRUD operations. Hypermedia-Driven: APIs are discoverable through links (HAL). Customization: Fine-tune the\u2026","rel":"","context":"In &quot;Spring Rest&quot;","block_context":{"text":"Spring Rest","link":"https:\/\/www.mymiller.name\/wordpress\/category\/spring_rest\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2023\/11\/network-3152677_640.jpg?fit=640%2C427&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2023\/11\/network-3152677_640.jpg?fit=640%2C427&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2023\/11\/network-3152677_640.jpg?fit=640%2C427&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":3704,"url":"https:\/\/www.mymiller.name\/wordpress\/spring_databases\/mastering-location-data-with-spring-jpa-a-comprehensive-guide\/","url_meta":{"origin":3421,"position":4},"title":"Mastering Location Data with Spring JPA: A Comprehensive Guide","author":"Jeffery Miller","date":"November 24, 2025","format":false,"excerpt":"In today\u2019s interconnected world, location data plays a pivotal role in numerous applications, from e-commerce and logistics to travel and social networking. Efficiently managing and accessing this wealth of geographical information is crucial for developers. This article delves into the realm of location data management using Spring JPA (Java Persistence\u2026","rel":"","context":"In &quot;Spring Databases&quot;","block_context":{"text":"Spring Databases","link":"https:\/\/www.mymiller.name\/wordpress\/category\/spring_databases\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/09\/international-1751293_1280.png?fit=1186%2C1200&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/09\/international-1751293_1280.png?fit=1186%2C1200&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/09\/international-1751293_1280.png?fit=1186%2C1200&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/09\/international-1751293_1280.png?fit=1186%2C1200&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/09\/international-1751293_1280.png?fit=1186%2C1200&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":3844,"url":"https:\/\/www.mymiller.name\/wordpress\/spring_messaging\/the-power-of-kafka-connect\/","url_meta":{"origin":3421,"position":5},"title":"The Power of Kafka Connect","author":"Jeffery Miller","date":"December 24, 2025","format":false,"excerpt":"Kafka Connect is a powerful framework for streaming data between Kafka and other systems in a scalable and reliable way. Connectors handle the complexities of data integration, allowing you to focus on your core application logic. Sink Connectors are used to export data from Kafka to other systems, and in\u2026","rel":"","context":"In &quot;Spring Messaging&quot;","block_context":{"text":"Spring Messaging","link":"https:\/\/www.mymiller.name\/wordpress\/category\/spring_messaging\/"},"img":{"alt_text":"","src":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/04\/ai-generated-8131434_1280-png.avif","width":350,"height":200,"srcset":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/04\/ai-generated-8131434_1280-png.avif 1x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/04\/ai-generated-8131434_1280-png.avif 1.5x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/04\/ai-generated-8131434_1280-png.avif 2x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2025\/04\/ai-generated-8131434_1280-png.avif 3x"},"classes":[]}],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts\/3421","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/comments?post=3421"}],"version-history":[{"count":2,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts\/3421\/revisions"}],"predecessor-version":[{"id":3423,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts\/3421\/revisions\/3423"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/media\/3417"}],"wp:attachment":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/media?parent=3421"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/categories?post=3421"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/tags?post=3421"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/series?post=3421"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}