Does anyone have a script to convert a Chrome Bookmarks file with [sub]*folders into a CVS file?












0















I want to be able to do Vimdiffs and Vimfolds on Bookmarks files that have been converted to CVS files ie with one description and one uri per line. However, because the Bookmarks file has multiple levels for the folders, the CSV file will also need fields for the different levels of folder names on each line.



I am new to jq but it seems like it should be able to do this sort of conversion?



Thanks,
Phil.










share|improve this question

























  • Hello Philip, Bienvenu on StackOverflow. Can you give more precision ? Some examples of input file and output result ? What is CVS file ? It is a CSV file ? Can you add some Key as Chrome or Javascript or JSON ?

    – schlebe
    Nov 14 '18 at 11:51











  • I just realised it is more complicated than I thought . .

    – Philip Rhoades P
    Nov 14 '18 at 13:07











  • ie Sorry, typo, yes I meant CSV. eg I was thinking of something like this in the Bookmarks: Dogs: - Doberman - Poodle Bikes: - Motorbikes - - Suzuki - - Honda - Bicycles but to have one record per line doesn't work very well: Dogs, Doberman Dogs, Poodle Bikes, Motorbikes, Suzuki Bikes, Motorbikes, Honda Bikes, Bicycles etc - cramming a tree structure into a CSV file is not as easy as I thought . . Ideas? Thanks.

    – Philip Rhoades P
    Nov 14 '18 at 13:17











  • Damn it ! All my formatting got wrapped . .

    – Philip Rhoades P
    Nov 14 '18 at 13:18











  • I think I will have to think about this a bit more - thanks anyway.

    – Philip Rhoades P
    Nov 14 '18 at 13:20
















0















I want to be able to do Vimdiffs and Vimfolds on Bookmarks files that have been converted to CVS files ie with one description and one uri per line. However, because the Bookmarks file has multiple levels for the folders, the CSV file will also need fields for the different levels of folder names on each line.



I am new to jq but it seems like it should be able to do this sort of conversion?



Thanks,
Phil.










share|improve this question

























  • Hello Philip, Bienvenu on StackOverflow. Can you give more precision ? Some examples of input file and output result ? What is CVS file ? It is a CSV file ? Can you add some Key as Chrome or Javascript or JSON ?

    – schlebe
    Nov 14 '18 at 11:51











  • I just realised it is more complicated than I thought . .

    – Philip Rhoades P
    Nov 14 '18 at 13:07











  • ie Sorry, typo, yes I meant CSV. eg I was thinking of something like this in the Bookmarks: Dogs: - Doberman - Poodle Bikes: - Motorbikes - - Suzuki - - Honda - Bicycles but to have one record per line doesn't work very well: Dogs, Doberman Dogs, Poodle Bikes, Motorbikes, Suzuki Bikes, Motorbikes, Honda Bikes, Bicycles etc - cramming a tree structure into a CSV file is not as easy as I thought . . Ideas? Thanks.

    – Philip Rhoades P
    Nov 14 '18 at 13:17











  • Damn it ! All my formatting got wrapped . .

    – Philip Rhoades P
    Nov 14 '18 at 13:18











  • I think I will have to think about this a bit more - thanks anyway.

    – Philip Rhoades P
    Nov 14 '18 at 13:20














0












0








0








I want to be able to do Vimdiffs and Vimfolds on Bookmarks files that have been converted to CVS files ie with one description and one uri per line. However, because the Bookmarks file has multiple levels for the folders, the CSV file will also need fields for the different levels of folder names on each line.



I am new to jq but it seems like it should be able to do this sort of conversion?



Thanks,
Phil.










share|improve this question
















I want to be able to do Vimdiffs and Vimfolds on Bookmarks files that have been converted to CVS files ie with one description and one uri per line. However, because the Bookmarks file has multiple levels for the folders, the CSV file will also need fields for the different levels of folder names on each line.



I am new to jq but it seems like it should be able to do this sort of conversion?



Thanks,
Phil.







json google-chrome jq bookmarks






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '18 at 15:02









peak

32.5k93960




32.5k93960










asked Nov 14 '18 at 11:35









Philip Rhoades PPhilip Rhoades P

62




62













  • Hello Philip, Bienvenu on StackOverflow. Can you give more precision ? Some examples of input file and output result ? What is CVS file ? It is a CSV file ? Can you add some Key as Chrome or Javascript or JSON ?

    – schlebe
    Nov 14 '18 at 11:51











  • I just realised it is more complicated than I thought . .

    – Philip Rhoades P
    Nov 14 '18 at 13:07











  • ie Sorry, typo, yes I meant CSV. eg I was thinking of something like this in the Bookmarks: Dogs: - Doberman - Poodle Bikes: - Motorbikes - - Suzuki - - Honda - Bicycles but to have one record per line doesn't work very well: Dogs, Doberman Dogs, Poodle Bikes, Motorbikes, Suzuki Bikes, Motorbikes, Honda Bikes, Bicycles etc - cramming a tree structure into a CSV file is not as easy as I thought . . Ideas? Thanks.

    – Philip Rhoades P
    Nov 14 '18 at 13:17











  • Damn it ! All my formatting got wrapped . .

    – Philip Rhoades P
    Nov 14 '18 at 13:18











  • I think I will have to think about this a bit more - thanks anyway.

    – Philip Rhoades P
    Nov 14 '18 at 13:20



















  • Hello Philip, Bienvenu on StackOverflow. Can you give more precision ? Some examples of input file and output result ? What is CVS file ? It is a CSV file ? Can you add some Key as Chrome or Javascript or JSON ?

    – schlebe
    Nov 14 '18 at 11:51











  • I just realised it is more complicated than I thought . .

    – Philip Rhoades P
    Nov 14 '18 at 13:07











  • ie Sorry, typo, yes I meant CSV. eg I was thinking of something like this in the Bookmarks: Dogs: - Doberman - Poodle Bikes: - Motorbikes - - Suzuki - - Honda - Bicycles but to have one record per line doesn't work very well: Dogs, Doberman Dogs, Poodle Bikes, Motorbikes, Suzuki Bikes, Motorbikes, Honda Bikes, Bicycles etc - cramming a tree structure into a CSV file is not as easy as I thought . . Ideas? Thanks.

    – Philip Rhoades P
    Nov 14 '18 at 13:17











  • Damn it ! All my formatting got wrapped . .

    – Philip Rhoades P
    Nov 14 '18 at 13:18











  • I think I will have to think about this a bit more - thanks anyway.

    – Philip Rhoades P
    Nov 14 '18 at 13:20

















Hello Philip, Bienvenu on StackOverflow. Can you give more precision ? Some examples of input file and output result ? What is CVS file ? It is a CSV file ? Can you add some Key as Chrome or Javascript or JSON ?

– schlebe
Nov 14 '18 at 11:51





Hello Philip, Bienvenu on StackOverflow. Can you give more precision ? Some examples of input file and output result ? What is CVS file ? It is a CSV file ? Can you add some Key as Chrome or Javascript or JSON ?

– schlebe
Nov 14 '18 at 11:51













I just realised it is more complicated than I thought . .

– Philip Rhoades P
Nov 14 '18 at 13:07





I just realised it is more complicated than I thought . .

– Philip Rhoades P
Nov 14 '18 at 13:07













ie Sorry, typo, yes I meant CSV. eg I was thinking of something like this in the Bookmarks: Dogs: - Doberman - Poodle Bikes: - Motorbikes - - Suzuki - - Honda - Bicycles but to have one record per line doesn't work very well: Dogs, Doberman Dogs, Poodle Bikes, Motorbikes, Suzuki Bikes, Motorbikes, Honda Bikes, Bicycles etc - cramming a tree structure into a CSV file is not as easy as I thought . . Ideas? Thanks.

– Philip Rhoades P
Nov 14 '18 at 13:17





ie Sorry, typo, yes I meant CSV. eg I was thinking of something like this in the Bookmarks: Dogs: - Doberman - Poodle Bikes: - Motorbikes - - Suzuki - - Honda - Bicycles but to have one record per line doesn't work very well: Dogs, Doberman Dogs, Poodle Bikes, Motorbikes, Suzuki Bikes, Motorbikes, Honda Bikes, Bicycles etc - cramming a tree structure into a CSV file is not as easy as I thought . . Ideas? Thanks.

– Philip Rhoades P
Nov 14 '18 at 13:17













Damn it ! All my formatting got wrapped . .

– Philip Rhoades P
Nov 14 '18 at 13:18





Damn it ! All my formatting got wrapped . .

– Philip Rhoades P
Nov 14 '18 at 13:18













I think I will have to think about this a bit more - thanks anyway.

– Philip Rhoades P
Nov 14 '18 at 13:20





I think I will have to think about this a bit more - thanks anyway.

– Philip Rhoades P
Nov 14 '18 at 13:20












1 Answer
1






active

oldest

votes


















0














Have you tried to use any free tools like: https://json-csv.com/



or json2csv: https://www.npmjs.com/package/json2csv



If neither of those works, perhaps this approach.



When I need to reconstruct data I write a set of loops that identify each property I want for each line in my CSV. Let's say my JSON has Name, Email, Phone but for some reason all are at different object levels in my JSON.



First right a loop that resolves Name, then a loop for Email, and one for Phone. At the end of the first loop call the second, and from the second call the third.



Then you can use jq -n which allows to create JSON with no input.



So your CSV output would be like jq -n '{NewName: .["'$Name'"]}'



once you have a clean JSON with all data points at the same level CSV conversion is smooth.



Hope this helps






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53299320%2fdoes-anyone-have-a-script-to-convert-a-chrome-bookmarks-file-with-subfolders%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Have you tried to use any free tools like: https://json-csv.com/



    or json2csv: https://www.npmjs.com/package/json2csv



    If neither of those works, perhaps this approach.



    When I need to reconstruct data I write a set of loops that identify each property I want for each line in my CSV. Let's say my JSON has Name, Email, Phone but for some reason all are at different object levels in my JSON.



    First right a loop that resolves Name, then a loop for Email, and one for Phone. At the end of the first loop call the second, and from the second call the third.



    Then you can use jq -n which allows to create JSON with no input.



    So your CSV output would be like jq -n '{NewName: .["'$Name'"]}'



    once you have a clean JSON with all data points at the same level CSV conversion is smooth.



    Hope this helps






    share|improve this answer




























      0














      Have you tried to use any free tools like: https://json-csv.com/



      or json2csv: https://www.npmjs.com/package/json2csv



      If neither of those works, perhaps this approach.



      When I need to reconstruct data I write a set of loops that identify each property I want for each line in my CSV. Let's say my JSON has Name, Email, Phone but for some reason all are at different object levels in my JSON.



      First right a loop that resolves Name, then a loop for Email, and one for Phone. At the end of the first loop call the second, and from the second call the third.



      Then you can use jq -n which allows to create JSON with no input.



      So your CSV output would be like jq -n '{NewName: .["'$Name'"]}'



      once you have a clean JSON with all data points at the same level CSV conversion is smooth.



      Hope this helps






      share|improve this answer


























        0












        0








        0







        Have you tried to use any free tools like: https://json-csv.com/



        or json2csv: https://www.npmjs.com/package/json2csv



        If neither of those works, perhaps this approach.



        When I need to reconstruct data I write a set of loops that identify each property I want for each line in my CSV. Let's say my JSON has Name, Email, Phone but for some reason all are at different object levels in my JSON.



        First right a loop that resolves Name, then a loop for Email, and one for Phone. At the end of the first loop call the second, and from the second call the third.



        Then you can use jq -n which allows to create JSON with no input.



        So your CSV output would be like jq -n '{NewName: .["'$Name'"]}'



        once you have a clean JSON with all data points at the same level CSV conversion is smooth.



        Hope this helps






        share|improve this answer













        Have you tried to use any free tools like: https://json-csv.com/



        or json2csv: https://www.npmjs.com/package/json2csv



        If neither of those works, perhaps this approach.



        When I need to reconstruct data I write a set of loops that identify each property I want for each line in my CSV. Let's say my JSON has Name, Email, Phone but for some reason all are at different object levels in my JSON.



        First right a loop that resolves Name, then a loop for Email, and one for Phone. At the end of the first loop call the second, and from the second call the third.



        Then you can use jq -n which allows to create JSON with no input.



        So your CSV output would be like jq -n '{NewName: .["'$Name'"]}'



        once you have a clean JSON with all data points at the same level CSV conversion is smooth.



        Hope this helps







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 20 '18 at 18:25









        GoldfishGoldfish

        91113




        91113
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53299320%2fdoes-anyone-have-a-script-to-convert-a-chrome-bookmarks-file-with-subfolders%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Florida Star v. B. J. F.

            Error while running script in elastic search , gateway timeout

            Adding quotations to stringified JSON object values