Online implement JSON landscaping (format), JSON turn CSV, CSV turn XML tools toolfk online Programmer toolbox - hubs/toolfk GitHub Wiki
This paper to recommend [ToolFk] is a programmers often use a free online test kit, ToolFk feature is focused on everyday programmer development tools, without having to install any software, as long as the content execution affixed by a button, able to obtain the contents of the desired results.ToolFk also supports BarCode Barcode generated online , QueryList collector , PHP code is run online , PHP confusion, encryption, decryption , Python code is run online , JavaScript online operation ,YAML formatting tools , HTTP simulation query tool , HTML online toolbox , JavaScript online Toolbox ,CSS online toolbox , JSON online toolbox , unixtime timestamp conversion , Base64 / the URL of / native2ascii conversion , CSV conversion kit , XML online toolbox , the WebSocket online tools , Markdown online toolbox , Htaccess2nginx conversion, Hex conversion online , online encryption toolkit ,online pseudo-original tools , online APK decompile , online web screenshot tool , online random password generation , online generate two-dimensional code qrcode , online Crontab Expression Builder ,the online short URL Generator , Online calculator tool . And more than 20 daily programmer development tools, can be considered a very comprehensive website programmer's toolbox.
Site name: ToolFk
website links: https://www.toolfk.com/
Tools link: https://www.toolfk.com/tool-format-json
? Teaching Code
This tool [Online JSON format, JSON turn the CSV, JSON turn XML] mainly depends on the following three JS library
https://github.com/nashwaan/xml-js#readme
https://github.com/evanplaice/jquery-csv
https://www.oschina.net/code/snippet_119610_11825
The following page
STEP 1
STEP 2
? THE CORE CODE IS AS FOLLOWS
var excerptRows = 7;
function renderCSV (objects) {
var rows = $ .csv.fromObjects (objects, {justArrays: true});
if (rows.length <1) return;
var table = document.createElement ( "table");
var thead = document.createElement ( "thead");
var tr = document.createElement ( "tr");
var header = rows [0];
for (field in header) {
var th = document.createElement ( "th");
$ (Th) .text (header [field]);
tr.appendChild (th);
}
thead.appendChild (tr);
var tbody = document.createElement ( "tbody");
for (var i = 1; i <rows.length; i ++) {
tr = document.createElement ( "tr");
for (field in rows [i]) {
var td = document.createElement ( "td");
$ (Td)
.text (rows [i] [field])
.attr ( "title", rows [i] [field]);
tr.appendChild (td);
}
tbody.appendChild (tr);
}
table.appendChild (thead);
table.appendChild (tbody);
return table.outerHTML;
}
function json_to_csv (message) {
var json = jsonFrom (message);
if (json) {
var inArray = arrayFrom (json);
var outArray = [];
for (var row in inArray)
outArray [outArray.length] = parse_object (inArray [row]);
var value = renderCSV (outArray.slice (0, excerptRows));
toolfk.report ( 'json_to_csv', value);
return value;
} Else {
var msg = "@lang ( 'toolfk.lang_text_valid_txt')";
layer.msg (msg);
return msg;
}
}
function json_to_xml (message) {
var value = json2xml (message, {compact: true, spaces: 4});
toolfk.report ( 'json_to_xml', value);
return value;
}
It is worth a try for three reasons:
-
Integrate various programmers often used in development and testing tools.
-
Simple and beautiful atmosphere of the site pages
-
Online support formatting code execution, APK online decompile, online high-strength password generator, two dozen screenshots online web tools service
-
Also recommend its sister network www.videofk.com video download Toolbox
This link: http://www.hihubs.com/article/368
