SupportWriter space ↗
REFERENCE LIBRARY

References from other publishers

Republished articles with source attribution. This collection is separate from Diary Coding’s original guides and does not display ads.

Read original guides → · Editorial policy

FOR YOUR CURIOSITY

Latest notes.

JACKSON / NOTES</>↗
Jackson13 Feb 2022

How do I convert CSV to JSON string using Jackson?

In the following code snippet we will convert CSV into JSON string using Jackson JSON library. A comma-separated values is a delimited text, it uses comma to separate values. It starts with header on the first line, that will be the JSON key. Each subsequence lines is the data of the csv, which also contains […]

Wayan · 3 min read
JSON-JAVA / NOTES</>↗
JSON-Java12 Feb 2022

How do I convert CSV file to or from JSON file?

In the following code snippet you will see how to convert a CSV file into JSON file and vice versa. We use the JSON-Java library CDL class to convert between CSV and JSON format. The CDL class provide the toJSONArray(String) and toString(JSONArray) methods that allows us to do the conversion between data format. In the […]

Wayan · 4 min read
JSON-JAVA / NOTES</>↗
JSON-Java10 Feb 2022

How do I convert CSV into JSON string using JSON-Java?

In this example we convert CSV or CDL into JSON string. We are going to use the JSON-Java CDL (Comma Delimited Text) class. This class provides static methods that will convert a CSV into JSONArray or to convert a JSONArray into comma separated values. Here are what we do in the code snippet below: Create […]

Wayan · 3 min read
GOOGLE GSON / NOTES</>↗
Google Gson10 Feb 2022

How do I pretty-print JSON string in Google Gson?

In the following example you’ll see how to format JSON string using the Google Gson library. Here are the steps: We create a Map. Put a couple key-value pairs to it. We put a string, a LocalDate object and an array of String[]. Create a Gson object using the GsonBuilder. This allows us to configure […]

Wayan · 2 min read
JSON-JAVA / NOTES</>↗
JSON-Java07 Feb 2022

How do I pretty print JSON string in JSON-Java?

In JSON-Java we can make a pretty-printed JSON string by specifying an indentFactor to the JSONObject‘s toString() method. The indent factor is the number of spaces to add to each level of indentation. If indentFactor > 0 and the JSONObject has only one key, the JSON string will be printed a single line, and if […]

Wayan · 2 min read
JSON-JAVA / NOTES</>↗
JSON-Java07 Feb 2022

How do I create JSONArray object?

A JSONArray object represent an ordered sequence of values. We use the put() method to add or replace values in the JSONArray object. The value can be of the following types: Boolean, JSONArray, JSONObject, Number, String or the JSONObject.NULL object. Beside using the put() method we can also create and add data into JSONArray in […]

Wayan · 3 min read
✳

Knowledge grows when shared.

Stay curious. There is always something new to learn.

Explore notes ↗
Putu Adi Guna Permana
ABOUT THE AUTHOR

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Writer and founder of Diary Coding — sharing notes, tutorials, and experiences about programming for anyone who wants to keep learning.