{"id":23670,"date":"2020-05-02T23:46:49","date_gmt":"2020-05-02T22:46:49","guid":{"rendered":"https:\/\/jurnsearch.wordpress.com\/?p=23670"},"modified":"2020-05-02T23:46:49","modified_gmt":"2020-05-02T22:46:49","slug":"json-to-csv-with-windows-freeware","status":"publish","type":"post","link":"https:\/\/jurn.link\/jurnsearch\/index.php\/2020\/05\/02\/json-to-csv-with-windows-freeware\/","title":{"rendered":".JSON to .CSV with Windows freeware"},"content":{"rendered":"<p><strong>Situation:<\/strong> You need to cleanly extract just the usernames from a .JSON file, and place each name on a new line.  The result should look like&#8230;<\/p>\n<p><em>name1<br \/>\nname2<br \/>\nname3<\/em><\/p>\n<p>The value being extracted from the JSON could just as easily be email addresses, or map co-ordinates, or suchlike.<\/p>\n<p><strong>Why you might do this:<\/strong> You can&#8217;t just do a simple &#8220;.JSON out, .JSON in&#8221;. For instance, let&#8217;s say you have a Web browser add-on that offers a blocklist function based on usernames. Perhaps it&#8217;s the deviantART-Filter. You want to port this 1,600 name blocklist of scum-and-villainy over to a similar browser add-on. Perhaps it&#8217;s the <a href=\"https:\/\/greasyfork.org\/en\/scripts\/5764-da-ignore\">dA_ignore<\/a> UserScript. The old deviantART-Filter usefully exports a .JSON file of your blocked users. But&#8230;. the new dA_ignore can only import a pasted-in list of usernames, one per line. <\/p>\n<p><strong>Solution 1:<\/strong> <\/p>\n<p>There is a working Regex for doing this, which only requires a recent copy of Notepad++ and a suitable .JSON file for the process&#8230; <\/p>\n<p><a href=\"https:\/\/jurn.link\/jurnsearch\/2020\/05\/extract-list-regex-large.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/jurn.link\/jurnsearch\/2020\/05\/extract-list-regex-large.jpg?w=529\" alt=\"\" width=\"529\" height=\"326\" class=\"alignnone size-large wp-image-23672\" \/><\/a><\/p>\n<p>It&#8217;s been tested and works. The use of the * wildcard will enable the extraction of a list in the form&#8230;<\/p>\n<p>path_label&#8221;:&#8221;<strong>any_value_here<\/strong><\/p>\n<p>After this regex has processed the code you are thus left with a list that looks like&#8230;<\/p>\n<p>username&#8221;:&#8221;name1<br \/>\nusername&#8221;:&#8221;name2<br \/>\nusername&#8221;:&#8221;name3<\/p>\n<p>&#8230; and you need only to do a basic search\/replace to clear <strong>username&#8221;:&#8221;<\/strong> to obtained your cleaned list of the various unique usernames.<\/p>\n<p>In this use-case you go to your own DeviantArt Settings page, and paste in the new ported-over blocklist. <\/p>\n<hr>\n<p><strong>Solution 2:<\/strong> <\/p>\n<p>1. Open the .JSON with the genuine Windows freeware <a href=\"https:\/\/www.majorgeeks.com\/files\/details\/jsonedit.html\">JSONedit<\/a>.<\/p>\n<p>2. Filter the JSON on field &#8220;username&#8221; by typing <em>username<\/em> into the search box. In &#8216;List view&#8217; you should now only see a list of the &#8220;username&#8221; fields and the adjacent data entry.<\/p>\n<p>3. Then go: top menu | &#8216;Tools&#8217; | &#8216;Export as .CSV&#8217;.<\/p>\n<p>4. Add a file extension .CSV to the saved file if needed, and then open it with Excel.  Select and copy out all the &#8220;usernames&#8221; column to a new Notepad++ file. <\/p>\n<p>5. In Notepad++, a quick search-replace will then remove the &#8220;&#8221; marks.  You now have a clean portable list, with one username per line.  <\/p>\n<hr>\n<p><strong>Solution 3:<\/strong> <\/p>\n<p>There are, of course, cloud services in Whereizitagain that may well offer to do this. But the above methods use Windows freeware and are thus more secure.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Situation: You need to cleanly extract just the usernames from a .JSON file, and place each name on a new &hellip;<\/p>\n<p><a href=\"https:\/\/jurn.link\/jurnsearch\/index.php\/2020\/05\/02\/json-to-csv-with-windows-freeware\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-23670","post","type-post","status-publish","format-standard","hentry","category-jurn-tips-and-tricks"],"_links":{"self":[{"href":"https:\/\/jurn.link\/jurnsearch\/index.php\/wp-json\/wp\/v2\/posts\/23670","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jurn.link\/jurnsearch\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jurn.link\/jurnsearch\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jurn.link\/jurnsearch\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jurn.link\/jurnsearch\/index.php\/wp-json\/wp\/v2\/comments?post=23670"}],"version-history":[{"count":0,"href":"https:\/\/jurn.link\/jurnsearch\/index.php\/wp-json\/wp\/v2\/posts\/23670\/revisions"}],"wp:attachment":[{"href":"https:\/\/jurn.link\/jurnsearch\/index.php\/wp-json\/wp\/v2\/media?parent=23670"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jurn.link\/jurnsearch\/index.php\/wp-json\/wp\/v2\/categories?post=23670"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jurn.link\/jurnsearch\/index.php\/wp-json\/wp\/v2\/tags?post=23670"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}