DISCLAIMER: The opinions expressed on this website are solely my own, and they are not associated with my employer, another person, or another organization in any way. All information on this website is provided "as is," without guarantee or warranty of any kind. Read the full disclaimer here.
This is a simple Flask web application that allows the user to perform the following conversions in their browser:
- JSON string -> CSV string
- CSV string -> JSON string
After navigating to the web app, the user is presented with two text boxes, two drop-down fields, and a “Convert” button. In order to convert a string, please follow the below steps:
- Paste the “source” string into the text box on the left.
- Select the correct “source” format in the drop down below (either JSON or CSV).
- The “target” format should auto-populate.
- Click the “Convert” button. The string will be converted into the target string format, and the output will be shown in the text box on the right.
This project utilizes the following technologies:
When the user clicks the “Convert” button, the following flow of events occurs:
- “Source” string value is encoded using base 64 encoding.
- The base 64 encoded “source” string is sent to the Flask web server using a jQuery AJAX POST request.
- The Flask web server decodes the base 64 encoded string.
- The Flask web server converts the string from “source” format into the specified “target” format.
- The Flask web server encodes the output string once again using base 64 encoding.
- The Flask web server serializes the response string into a JSON object.
- the Flask web server returns the JSON response object to the browser.
- The base 64 encoded output string is decoded.
- The output string is displayed in the “target” text box.
Please click the “View on GitHub” button below to see the full project source code.