Formatter

Formatter is used to format the given data. It is designed to handle the conversion of data between different formats, such as CSV, string, XML, and JSON. Also, the formatter provides the ability to generate the timestamp and convert between timezones. This tool facilitates the transformation of data to and from the JSON format, offering seamless interoperability.

Options

Formatter Actions

JSON to STRING

Converts JSON to Stringified JSON.

Data:
{"name": "John Doe",   "age": 30,   "city": "Exampleville" }

Output:
"{\"name\": \"John Doe\", \"age\": 30, \"city\": \"Exampleville\" }"

STRING to JSON

Converts stringified JSON to JSON.

Data:
"{\"name\": \"John Doe\", \"age\": 30, \"city\": \"Exampleville\"}"

Output:
{"name": "John Doe", "age": 30, "city": "Exampleville"

XML to JSON

Converts XML to JSON format

Data:
<person><name>John Doe</name><age>30</age><city>Exampleville</city></person>

Output:
{'person': {'name': 'John Doe', 'age': '30', 'city': 'Exampleville'}}

JSON to CSV

Converts JSON to CSV format

Data:
[
  {
    "name": "John Doe",
    "age": 30,
    "email": "john@example.com",
     "street": "123 Main St",
      "city": "New York",
      "zip": "10001"
  },
  {
    "name": "Jane Smith",
    "age": 25,
    "email": "jane@example.com",
      "street": "456 Elm St",
      "city": "Los Angeles",
      "zip": "90001"
  }
]

Output:
b'name,age,email,street,city,zip\nJohn Doe,30,john@example.com,123 Main St,New York,10001\nJane Smith,25,jane@example.com,456 Elm St,Los Angeles,90001\n'

CSV to JSON

Converts CSV to JSON format. New lines can be entered as a new line or as \n

Data 1:
"name,age,email,street,city,zip
John Doe,30,john@example.com,123 Main St,New York,10001
Jane Smith,25,jane@example.com,456 Elm St,Los Angeles,90001"

Data 2:
"name,age,email,street,city,zip\nJohn Doe,30,john@example.com,123 Main St,New York,10001\nJane Smith,25,jane@example.com,456 Elm St,Los Angeles,90001\n"

Output:
[{'name': 'John Doe', 'age': '30', 'email': 'john@example.com', 'street': '123 Main St', 'city': 'New York', 'zip': '10001'}, {'name': 'Jane Smith', 'age': '25', 'email': 'jane@example.com', 'street': '456 Elm St', 'city': 'Los Angeles', 'zip': '90001'}]

Generate Timestamp

Option to generate a timestamp from a given date time.

Usage Example

Data (to be formatted): Enter the date and time from which you want to generate a timestamp.

From Time Zone: Select the time zone of the input date and time you want to convert the timestamp to.

Refer Allowed Datetime Formats for the datetime structure format

Convert Timezone

Option to convert date and time from one timezone to another. This is particularly useful when you need to work with date and time data originating from different locations around the world.

Usage Example

Data (to be formatted): Enter the date and time you want to convert

For date-time input: Provide your date-time input.

From Time Zone: Select the original time zone of the input date and time.

To Time Zone: Choose the target time zone to which you want to convert the input date and time.

Output Date Format: Specify the desired format for the converted date and time. You can use the format codes described below to define the format as per your requirements.

Refer Allowed Datetime Formats for the datetime structure format

Output

The "Convert Timezone" option will provide the date and time converted to the specified target time zone, formatted according to your specified output date format.

Allowed DateTime Formats

The following formats are supported:

Format
Value
Description

%d

27

numerical representation of day

%a

Sat

short alphabetical representation of day

%A

Saturday

alphabetical representation of day

%m

01

numerical representation of month

%b

Jan

short alphabetical representation of month

%B

January

alphabetical representation of month

%y

18

short representation of year

%Y

2018

numerical representation of year

%H

10

hour

%M

30

minute

%f

012345

microseconds

%p

AM

meridiem

%z

+0530

timezone offset

Examples for reference :

Input
Format

2021-05-27 01:30:00 PM

%Y-%m-%d %H:%M:%S %p

2021-05-12T09:46:47-0400

%Y-%m-%dT%H:%M:%S%z

Sat, 27 Jan 2018 17:16:55 +0000

%a, %d %b %Y %H:%M:%S %z

2018-01-27T13:34:25.518993+0530

%Y-%m-%dT%H:%M:%S.%f%z

Last updated