Convert text list to JSON format

Lists are textual data separated by line breaks. Thus, each new line will be converted into a separate element of the JSON array.

In the ordinary life of developers, webmasters and other IT professions, there are times when they are faced with the need to convert lists to JSON or any other format for further manipulation of this information. 

What is JSON?

JSON (JavaScript Object Notation) is a textual data exchange and storage format based on JavaScript. But at the same time, this format is used in all programming languages and is mainly used to transfer data between the server and the client.

 

How do I convert a list to JSON?

To do this, you need to go to a site with an online tool for converting a list to JSON. Paste your list into the editor and click on the “Convert” button.

And you will receive your JSON instantly.

Examples

  • You have a list of countries (separated by newlines) and you need to convert them to a JSON array to add them to some plugin, or output them to <select> html.
  • You have a list of Email addresses for which you need to do some kind of mailing or something else.
  • Or did you export ID numbers from your database for some kind of manipulation

In fact, only a small part is described here where you may need to convert lists to JSON or to some other format.

Let’s see how the tool works with a real example, let’s say we have a list of emails that we want to convert to JSON.

examle@example.com

test@test.com

one@more.com

e.t.c.

After the transformation, we get the following JSON:

[“examle@example.com”,”test@test.com”,”one@more.com”]

As you can see, there is nothing difficult and very easy to use in this, and most importantly, you do not need developer’s help in order to convert your list to JSON.

Converting lists to JSON can be replaced by converting CSV to JSON, because a list is the same CSV itself, with only one column and no separators.

Leave a Comment