ToolFk is a free test kit that programmers use online. ToolFk focuses on the tools that programmers use every day. You don’t need to install any software, just paste the content and press the execute button to get the results you want. ToolFk also supports BarCode BarCode generation online, QueryList collector, PHP code running online, PHP obfuscation, encryption, decryption, Python code online running, JavaScript online running, YAML Formatting Tool, HTTP simulation query tool, HTML online toolbox, JavaScript online toolbox, CSS online toolbox, JSON online toolbox, Unixtime timestamp conversion, Base64/URL/N Ative2Ascii conversion, CSV conversion toolbox, XML online toolbox, WebSocket online tool, Markdown online toolbox, Htaccess2nginx Conversion, base online conversion, online encryption toolbox, online pseudo-original tool, online APK decompile, online webpage screenshot tool, online random password generation, online Qrcode Qrcode generation, online Crontab expression generation, online short url generation, online calculator tool. Such as more than 20 daily programmer development tools, is a very comprehensive programmer toolbox site.


Site name: ToolFk Site Link: www.toolfk.com/ Tool link: www.toolfk.com/tool-format…

The code of teaching

This tool [JSON formatting online, JSON to CSV, JSON to XML] relies on the following three JS libraries

Github.com/nashwaan/xm…

Github.com/evanplaice/…

www.oschina.net/code/snippe…

The page is as follows

STEP 1



STEP 2

The core code is as follows

<script type="text/javascript">
        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);
                returnmsg; }}function json_to_xml(message){
           var value=  json2xml(message, {compact: true, spaces: 4});
           toolfk.report('json_to_xml',value);
           return value;
        }


        $(function(){
            var sourceArea = toolfk.create_codeMirror('code');
            var targetArea = toolfk.create_codeMirror('result'.'text/html');

            $("#CollapsibleView").click(function() {$id("CollapsibleViewDetail").style.visibility = $id("CollapsibleView").checked ? "visible" : "hidden";
                var source = sourceArea.getValue();
                if(source= =' ') {return layer.msg('@lang('toolfk.lang_context_not_empty') ');
                }
                $(targetArea.getWrapperElement()).hide();
                Process(source);
            });

            $("#QuoteKeys").click(function(){
                window.QuoteKeys = $id("QuoteKeys").checked;
                var source = sourceArea.getValue();
                if(source= =' ') {return layer.msg('@lang('toolfk.lang_context_not_empty') ');
                }
                $(targetArea.getWrapperElement()).hide();
                Process(source);
            });


            $("#TabSize").click(function(){
                var source = sourceArea.getValue();
                if(source= =' ') {return layer.msg('@lang('toolfk.lang_context_not_empty') ');
                }
                $(targetArea.getWrapperElement()).hide();
                Process(source);
            });

            $(".convert-btn-format").click(function() {if (toolfk.beautify_default.beautify_in_progress) {
                    return;
                }
                var source = sourceArea.getValue();
                if(source= =' ') {return layer.msg('@lang('toolfk.lang_context_not_empty') ');
                }
                toolfk.beautify_default.beautify_in_progress = true;
                $(targetArea.getWrapperElement()).hide();
                Process(source);
                toolfk.beautify_default.beautify_in_progress = false;
            });


            $(".convert-btn").click(function() {if (toolfk.beautify_default.beautify_in_progress) {
                    return;
                }
                var source = sourceArea.getValue();
                if(source= =' ') {return layer.msg('@lang('toolfk.lang_context_not_empty') ');
                }
                toolfk.beautify_default.beautify_in_progress = true;
                $(targetArea.getWrapperElement()).show();
                $("#Canvas").hide();

                var func_method = $(this).data("func");

                var func        =   eval(func_method);
                var result      =   func(source);
                targetArea.setValue(result);
                toolfk.beautify_default.beautify_in_progress = false;
            });
        });
    </script>
Copy the code

  1. Three reasons it’s worth a try:
  2. Integrate a variety of development test tools commonly used in programmer development.
  3. Simple and beautiful atmosphere of the website page
  4. Support online formatting execution code, APK online decompilation, online high-strength password generation, online web page screenshots and more than 20 tool services
  5. Also recommend its sister network www.videofk.com video download toolbox

This paper links: www.hihubs.com/article/368