New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

anytojson

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

anytojson

Fetches CSV, JSON data from REST APIs, Flat Files etc and converts them to JSON.

  • 2.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
decreased by-40%
Maintainers
1
Weekly downloads
 
Created
Source

anyToJSON Build Status

Fetches data from anywhere(or atleast strives to) and converts it to JSON. Currently converts flat-file JSON, flat-file CSV, REST JSON, REST CSV and Databases(via ODBC) to JSON.

TOC

Examples

csv file to json

should convert csv to json.

anyToJSON.csv({path: "test/100.csv"}, function(data){
    var output = [{"a":"4","b":"9","c":"2","d":"3"}];
    var anyToJSONdata = data;
    assert.equal(JSON.stringify(anyToJSONdata), JSON.stringify(output));
    done()
});

should not break when there are commas in strings.

anyToJSON.csv({path: "test/test.csv"}, function(data){
    var output = [{"Id":"1","UserName":"Sam, Smith"},
                    {"Id":"2","UserName":"Fred Frankly"},
                    {"Id":"1","UserName":"Zachary Zupers"}];
    anyToJSONdata = data;
    assert.equal(JSON.stringify(anyToJSONdata), JSON.stringify(output));
    done();
})

loading json from a file

should load json from a file.

anyToJSON.json({path: "test/test.json"}, function(data){
                var output = [{"a":"4","b":"9","c":"2","d":"3"}];
                anyToJSONdata = data;
                assert.equal(JSON.stringify(anyToJSONdata), JSON.stringify(output));
                done()
            });

loading json from rest

should load json from rest.

server.startServer(function(){
    anyToJSON.restJSON({
        hostname: "localhost",
        port: 3000,
        path: "/json"},function(data){
            var output = [{"a":"4","b":"9","c":"2","d":"3"}];
            var anyToJSONdata = data;
            assert.equal(JSON.stringify(anyToJSONdata), JSON.stringify(output));
            done();
    })
});

loading csv from rest

should load csv from rest.

server.startServer(function(){
    anyToJSON.restCSV({
        hostname:"localhost",
        port: 3000,
        path: "/csv"}, function(data){
            anyToJSONdata = data;
            var output = [{"a":"4","b":"9","c":"2","d":"3"}]
            assert.equal(JSON.stringify(anyToJSONdata), JSON.stringify(output));
            done();
    
    })
})

Support

  • CSV flat file
  • JSON flat file
  • CSV REST API
  • JSON REST API
  • Databases (ODBC support)

Future Plans

  • Support for XML
  • Support for Streaming data

Keywords

FAQs

Package last updated on 22 Dec 2015

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc