Socket
Socket
Sign inDemoInstall

json-to-csv-in-browser

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    json-to-csv-in-browser

This converts the json array in the browser to csv file that can be stored in disc


Version published
Weekly downloads
216
increased by7.46%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

json-to-csv-in-browser

This module creats the csv file inside the browser itself supply jsonarray it will give back file of csv

    <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>Test</h1>
    <button id="btn">Click</button>
</body>
    <script type="module"src="client.js" ></script>

    
</html>

 import {JsonArray, download} from "./node_modules/json-to-csv-in-browser/lib/index.js"


mybtn = document.getElementById("btn").addEventListener("click",()=>{

  let arr = [
    {name : `umesh, bilsgai
    sghg 
    susuus`, age : 53},
    {name : "ramya", age : 38},
    {name : "pradyu", age : 22}
]
  let jsonArray = new JsonArray(arr);
  let str = jsonArray.convertToCSVstring();
  download("my.csv", str);

Keywords

FAQs

Last updated on 07 Feb 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc