Importing JavaScript and Data
With JsRates, you can import JavaScript code from .js
, .mjs
, .ts
, or .txt
files, as well as data from CSV files that are automatically converted to JSON objects.
To import files, follow these steps:
- Go to the Editor page.
- Click on the More Actions dropdown.
- Choose Import to open the import window.
- Upload your file from your local system or paste the file URL.
Upon importing a CSV file, it will be parsed into a JSON object where:
- CSV column headers become JSON keys.
- Rows under each header are converted into an array of values for their respective keys, forming the JSON object values.
See an example on importing large data (the postal codes of 16,146 cities in Australia) for custom carrier rates. Importing data - sample code