$csv to json

Allows you to convert a CSV file to JSON.


Example

Running this code will set a variable named "#Debug", converting the csv string to "json" type:

[
 {
  "Rank": "1",
  "URL": "facebook.com/",
  "Linking_Root_Domains": "9616487",
  "External_Links": "1688316928",
  "mozRank": "9.54",
  "mozTrust": "9.34"
 },
 {
  "Rank": "2",
  "URL": "twitter.com/",
  "Linking_Root_Domains": "6454936",
  "External_Links": "2147483647",
  "mozRank": "9.4",
  "mozTrust": "9.25"
 },
 {
  "Rank": "3",
  "URL": "google.com/",
  "Linking_Root_Domains": "5868081",
  "External_Links": "807173458",
  "mozRank": "9.3",
  "mozTrust": "9.27"
 },
 {
  "Rank": "4",
  "URL": "youtube.com/",
  "Linking_Root_Domains": "5442206",
  "External_Links": "841281214",
  "mozRank": "9.25",
  "mozTrust": "9.11"
 },
 {
  "Rank": "5",
  "URL": "wordpress.org/",
  "Linking_Root_Domains": "4051288",
  "External_Links": "361023992",
  "mozRank": "8.99",
  "mozTrust": "8.71"
 },
 {
  "Rank": "6",
  "URL": "adobe.com/",
  "Linking_Root_Domains": "3498190",
  "External_Links": "232289315",
  "mozRank": "9.3",
  "mozTrust": "9.27"
 },
 {
  "Rank": "7",
  "URL": "blogspot.com/",
  "Linking_Root_Domains": "3073493",
  "External_Links": "793032047",
  "mozRank": "8.77",
  "mozTrust": "8.71"
 },
 {
  "Rank": "8",
  "URL": "wikipedia.org/",
  "Linking_Root_Domains": "2917053",
  "External_Links": "206217734",
  "mozRank": "8.83",
  "mozTrust": "8.72"
 },
 {
  "Rank": "9",
  "URL": "linkedin.com/",
  "Linking_Root_Domains": "2435569",
  "External_Links": "327700219",
  "mozRank": "8.95",
  "mozTrust": "8.81"
 },
 {
  "Rank": "10",
  "URL": "wordpress.com/",
  "Linking_Root_Domains": "2340965",
  "External_Links": "569397042",
  "mozRank": "8.65",
  "mozTrust": "8.6"
 }
]

Here is the code view for reference:

set(#Debug,$plugin function("Data and Files Automation.dll", "$csv to json", "Rank,URL,Linking Root Domains,External Links,mozRank,mozTrust
1,facebook.com/,9616487,1688316928,9.54,9.34
2,twitter.com/,6454936,2147483647,9.4,9.25
3,google.com/,5868081,807173458,9.3,9.27
4,youtube.com/,5442206,841281214,9.25,9.11
5,wordpress.org/,4051288,361023992,8.99,8.71
6,adobe.com/,3498190,232289315,9.3,9.27
7,blogspot.com/,3073493,793032047,8.77,8.71
8,wikipedia.org/,2917053,206217734,8.83,8.72
9,linkedin.com/,2435569,327700219,8.95,8.81
10,wordpress.com/,2340965,569397042,8.65,8.6"),"Global")

Was this helpful?

Previous Article

$create title case

Next Article

$csv to string