How to decode/decipher Mozilla Firefox proprietary .jsonlz4 format? (sessionstore-backups/recovery.jsonlz4)

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
9
down vote

favorite
2












I'm trying to get a handle on Mozilla Firefox's proprietary file format .jsonlz4, used, for example, for sessionstore-backups/recovery.jsonlz4, but to no avail.



How do I get back my data, specifically, some long text I've typed in some textareas of a crashed session? It's my data!










share|improve this question

















  • 5




    I wouldn't call the format proprietary. Granted, it's custom, not used anywhere outside Mozilla projects, but since the whole of Firefox—including the relevant (de)compression code—is free and open source, this format shouldn't be called proprietary. (P.S. I'm not talking of the branding, which is licensed differently.)
    – Ruslan
    Oct 4 at 9:46











  • @Ruslan, but it is in fact proprietary — just because it's OSS doesn't make it non-proprietary, as there are zero standard tools to look into the content of these files, whereas all other files, even Java's JAR format, can easily be managed with 100% standard non-proprietary tools that are available in ports/packages of every decent UNIX system. OTOH, it is completely non-trivial to actually get back your own data from these .jsonlz4 files.
    – cnst
    2 days ago














up vote
9
down vote

favorite
2












I'm trying to get a handle on Mozilla Firefox's proprietary file format .jsonlz4, used, for example, for sessionstore-backups/recovery.jsonlz4, but to no avail.



How do I get back my data, specifically, some long text I've typed in some textareas of a crashed session? It's my data!










share|improve this question

















  • 5




    I wouldn't call the format proprietary. Granted, it's custom, not used anywhere outside Mozilla projects, but since the whole of Firefox—including the relevant (de)compression code—is free and open source, this format shouldn't be called proprietary. (P.S. I'm not talking of the branding, which is licensed differently.)
    – Ruslan
    Oct 4 at 9:46











  • @Ruslan, but it is in fact proprietary — just because it's OSS doesn't make it non-proprietary, as there are zero standard tools to look into the content of these files, whereas all other files, even Java's JAR format, can easily be managed with 100% standard non-proprietary tools that are available in ports/packages of every decent UNIX system. OTOH, it is completely non-trivial to actually get back your own data from these .jsonlz4 files.
    – cnst
    2 days ago












up vote
9
down vote

favorite
2









up vote
9
down vote

favorite
2






2





I'm trying to get a handle on Mozilla Firefox's proprietary file format .jsonlz4, used, for example, for sessionstore-backups/recovery.jsonlz4, but to no avail.



How do I get back my data, specifically, some long text I've typed in some textareas of a crashed session? It's my data!










share|improve this question













I'm trying to get a handle on Mozilla Firefox's proprietary file format .jsonlz4, used, for example, for sessionstore-backups/recovery.jsonlz4, but to no avail.



How do I get back my data, specifically, some long text I've typed in some textareas of a crashed session? It's my data!







firefox backup json session-restore jsonlz4






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Oct 4 at 0:35









cnst

1,13931634




1,13931634







  • 5




    I wouldn't call the format proprietary. Granted, it's custom, not used anywhere outside Mozilla projects, but since the whole of Firefox—including the relevant (de)compression code—is free and open source, this format shouldn't be called proprietary. (P.S. I'm not talking of the branding, which is licensed differently.)
    – Ruslan
    Oct 4 at 9:46











  • @Ruslan, but it is in fact proprietary — just because it's OSS doesn't make it non-proprietary, as there are zero standard tools to look into the content of these files, whereas all other files, even Java's JAR format, can easily be managed with 100% standard non-proprietary tools that are available in ports/packages of every decent UNIX system. OTOH, it is completely non-trivial to actually get back your own data from these .jsonlz4 files.
    – cnst
    2 days ago












  • 5




    I wouldn't call the format proprietary. Granted, it's custom, not used anywhere outside Mozilla projects, but since the whole of Firefox—including the relevant (de)compression code—is free and open source, this format shouldn't be called proprietary. (P.S. I'm not talking of the branding, which is licensed differently.)
    – Ruslan
    Oct 4 at 9:46











  • @Ruslan, but it is in fact proprietary — just because it's OSS doesn't make it non-proprietary, as there are zero standard tools to look into the content of these files, whereas all other files, even Java's JAR format, can easily be managed with 100% standard non-proprietary tools that are available in ports/packages of every decent UNIX system. OTOH, it is completely non-trivial to actually get back your own data from these .jsonlz4 files.
    – cnst
    2 days ago







5




5




I wouldn't call the format proprietary. Granted, it's custom, not used anywhere outside Mozilla projects, but since the whole of Firefox—including the relevant (de)compression code—is free and open source, this format shouldn't be called proprietary. (P.S. I'm not talking of the branding, which is licensed differently.)
– Ruslan
Oct 4 at 9:46





I wouldn't call the format proprietary. Granted, it's custom, not used anywhere outside Mozilla projects, but since the whole of Firefox—including the relevant (de)compression code—is free and open source, this format shouldn't be called proprietary. (P.S. I'm not talking of the branding, which is licensed differently.)
– Ruslan
Oct 4 at 9:46













@Ruslan, but it is in fact proprietary — just because it's OSS doesn't make it non-proprietary, as there are zero standard tools to look into the content of these files, whereas all other files, even Java's JAR format, can easily be managed with 100% standard non-proprietary tools that are available in ports/packages of every decent UNIX system. OTOH, it is completely non-trivial to actually get back your own data from these .jsonlz4 files.
– cnst
2 days ago




@Ruslan, but it is in fact proprietary — just because it's OSS doesn't make it non-proprietary, as there are zero standard tools to look into the content of these files, whereas all other files, even Java's JAR format, can easily be managed with 100% standard non-proprietary tools that are available in ports/packages of every decent UNIX system. OTOH, it is completely non-trivial to actually get back your own data from these .jsonlz4 files.
– cnst
2 days ago










2 Answers
2






active

oldest

votes

















up vote
10
down vote













As per https://www.reddit.com/r/firefox/comments/2ps6wg/jsonlz4_bookmark_backups/, the following appears to work:



  • in about:config, toggle the devtools.chrome.enabled settings from the default of false to a value of true



  • open Scratchpad:



    • either with fn+Shift+F4 on a MacBook,

    • or Shift+F4,

    • or through the menu bar through Tools, Web Developer, Scratchpad


  • in the menu bar within Scratchpad, change Enrivonment from Content to Browser (omitting this step would subsequently result in errors like Exception: ReferenceError: OS is not defined at the next step)



  • use code like the following in the Scratchpad:



    var file = "var file = "/Users/…/sessionstore-backups/recovery.baklz4";
    //OS.File.read(file, compression: "lz4" ).then(bytes =>
    // OS.File.writeAtomic(file + ".uncompressed", bytes));

    OS.File.read(file, compression: "lz4" ).then(bytes =>
    OS.File.writeAtomic(file + ".uncompressed.stringify",
    JSON.stringify(JSON.parse(new TextDecoder().decode(bytes)),null,1))
    );


    The final parameter to JSON.stringify handles how many spaces would be used at each line; putting 0 causes the whole thing to be printed on a single line, putting 1 splits the lines properly (putting 2 would create too much useless whitespace and increase the size of the file for little benefit)



  • click the Run button


  • run fgrep :textarea /Users/…/sessionstore-backups/recovery.baklz4.uncompressed.stringify from within the Terminal app






share|improve this answer



























    up vote
    4
    down vote













    Unfortunately, due to a non-standard header, standard tools won't work. There's an open proposal to change that. Apparently the Mozilla header was devised before a standard lz4 frame format existed; it does wrap a standard lz4 block.



    That said, the same bug report includes a few alternative methods. I'll list them briefly:



    • Use the dejsonlz4 tool, which includes binary builds for Windows and should be easy to build on *nix


      • lz4json is a similar tool, but relies on an external liblz4 and is somewhat easier to build on *nix but harder on Windows (outside WSL)


    • Use this fairly simple Python script: https://gist.github.com/Tblue/62ff47bef7f894e92ed5 (requires the lz4 package via pip or your package manager) -- the script appears to be python3 but is trivially adaptable to python2

    • There is a webextension available that should be able to open these. NB: while source is available, I have not verified it, and the permissions it requests are a bit concerning (especially the response to concerns)

    • In theory, you should be able to strip the first 8 bytes (e.g. with dd if=original.jsonlz4 of=stripped.lz4 bs=8 skip=1) and that should leave you with a valid lz4 block. Note that this is distinct from a lz4 frame. While most programming languages have libraries that can easily decode a block, finding a prebuilt tool to do so is more difficult, e.g. the liblz4-tool package only accepts the frame format.





    share|improve this answer




















      Your Answer







      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "3"
      ;
      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',
      convertImagesToLinks: true,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1363747%2fhow-to-decode-decipher-mozilla-firefox-proprietary-jsonlz4-format-sessionstor%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      10
      down vote













      As per https://www.reddit.com/r/firefox/comments/2ps6wg/jsonlz4_bookmark_backups/, the following appears to work:



      • in about:config, toggle the devtools.chrome.enabled settings from the default of false to a value of true



      • open Scratchpad:



        • either with fn+Shift+F4 on a MacBook,

        • or Shift+F4,

        • or through the menu bar through Tools, Web Developer, Scratchpad


      • in the menu bar within Scratchpad, change Enrivonment from Content to Browser (omitting this step would subsequently result in errors like Exception: ReferenceError: OS is not defined at the next step)



      • use code like the following in the Scratchpad:



        var file = "var file = "/Users/…/sessionstore-backups/recovery.baklz4";
        //OS.File.read(file, compression: "lz4" ).then(bytes =>
        // OS.File.writeAtomic(file + ".uncompressed", bytes));

        OS.File.read(file, compression: "lz4" ).then(bytes =>
        OS.File.writeAtomic(file + ".uncompressed.stringify",
        JSON.stringify(JSON.parse(new TextDecoder().decode(bytes)),null,1))
        );


        The final parameter to JSON.stringify handles how many spaces would be used at each line; putting 0 causes the whole thing to be printed on a single line, putting 1 splits the lines properly (putting 2 would create too much useless whitespace and increase the size of the file for little benefit)



      • click the Run button


      • run fgrep :textarea /Users/…/sessionstore-backups/recovery.baklz4.uncompressed.stringify from within the Terminal app






      share|improve this answer
























        up vote
        10
        down vote













        As per https://www.reddit.com/r/firefox/comments/2ps6wg/jsonlz4_bookmark_backups/, the following appears to work:



        • in about:config, toggle the devtools.chrome.enabled settings from the default of false to a value of true



        • open Scratchpad:



          • either with fn+Shift+F4 on a MacBook,

          • or Shift+F4,

          • or through the menu bar through Tools, Web Developer, Scratchpad


        • in the menu bar within Scratchpad, change Enrivonment from Content to Browser (omitting this step would subsequently result in errors like Exception: ReferenceError: OS is not defined at the next step)



        • use code like the following in the Scratchpad:



          var file = "var file = "/Users/…/sessionstore-backups/recovery.baklz4";
          //OS.File.read(file, compression: "lz4" ).then(bytes =>
          // OS.File.writeAtomic(file + ".uncompressed", bytes));

          OS.File.read(file, compression: "lz4" ).then(bytes =>
          OS.File.writeAtomic(file + ".uncompressed.stringify",
          JSON.stringify(JSON.parse(new TextDecoder().decode(bytes)),null,1))
          );


          The final parameter to JSON.stringify handles how many spaces would be used at each line; putting 0 causes the whole thing to be printed on a single line, putting 1 splits the lines properly (putting 2 would create too much useless whitespace and increase the size of the file for little benefit)



        • click the Run button


        • run fgrep :textarea /Users/…/sessionstore-backups/recovery.baklz4.uncompressed.stringify from within the Terminal app






        share|improve this answer






















          up vote
          10
          down vote










          up vote
          10
          down vote









          As per https://www.reddit.com/r/firefox/comments/2ps6wg/jsonlz4_bookmark_backups/, the following appears to work:



          • in about:config, toggle the devtools.chrome.enabled settings from the default of false to a value of true



          • open Scratchpad:



            • either with fn+Shift+F4 on a MacBook,

            • or Shift+F4,

            • or through the menu bar through Tools, Web Developer, Scratchpad


          • in the menu bar within Scratchpad, change Enrivonment from Content to Browser (omitting this step would subsequently result in errors like Exception: ReferenceError: OS is not defined at the next step)



          • use code like the following in the Scratchpad:



            var file = "var file = "/Users/…/sessionstore-backups/recovery.baklz4";
            //OS.File.read(file, compression: "lz4" ).then(bytes =>
            // OS.File.writeAtomic(file + ".uncompressed", bytes));

            OS.File.read(file, compression: "lz4" ).then(bytes =>
            OS.File.writeAtomic(file + ".uncompressed.stringify",
            JSON.stringify(JSON.parse(new TextDecoder().decode(bytes)),null,1))
            );


            The final parameter to JSON.stringify handles how many spaces would be used at each line; putting 0 causes the whole thing to be printed on a single line, putting 1 splits the lines properly (putting 2 would create too much useless whitespace and increase the size of the file for little benefit)



          • click the Run button


          • run fgrep :textarea /Users/…/sessionstore-backups/recovery.baklz4.uncompressed.stringify from within the Terminal app






          share|improve this answer












          As per https://www.reddit.com/r/firefox/comments/2ps6wg/jsonlz4_bookmark_backups/, the following appears to work:



          • in about:config, toggle the devtools.chrome.enabled settings from the default of false to a value of true



          • open Scratchpad:



            • either with fn+Shift+F4 on a MacBook,

            • or Shift+F4,

            • or through the menu bar through Tools, Web Developer, Scratchpad


          • in the menu bar within Scratchpad, change Enrivonment from Content to Browser (omitting this step would subsequently result in errors like Exception: ReferenceError: OS is not defined at the next step)



          • use code like the following in the Scratchpad:



            var file = "var file = "/Users/…/sessionstore-backups/recovery.baklz4";
            //OS.File.read(file, compression: "lz4" ).then(bytes =>
            // OS.File.writeAtomic(file + ".uncompressed", bytes));

            OS.File.read(file, compression: "lz4" ).then(bytes =>
            OS.File.writeAtomic(file + ".uncompressed.stringify",
            JSON.stringify(JSON.parse(new TextDecoder().decode(bytes)),null,1))
            );


            The final parameter to JSON.stringify handles how many spaces would be used at each line; putting 0 causes the whole thing to be printed on a single line, putting 1 splits the lines properly (putting 2 would create too much useless whitespace and increase the size of the file for little benefit)



          • click the Run button


          • run fgrep :textarea /Users/…/sessionstore-backups/recovery.baklz4.uncompressed.stringify from within the Terminal app







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 4 at 0:35









          cnst

          1,13931634




          1,13931634






















              up vote
              4
              down vote













              Unfortunately, due to a non-standard header, standard tools won't work. There's an open proposal to change that. Apparently the Mozilla header was devised before a standard lz4 frame format existed; it does wrap a standard lz4 block.



              That said, the same bug report includes a few alternative methods. I'll list them briefly:



              • Use the dejsonlz4 tool, which includes binary builds for Windows and should be easy to build on *nix


                • lz4json is a similar tool, but relies on an external liblz4 and is somewhat easier to build on *nix but harder on Windows (outside WSL)


              • Use this fairly simple Python script: https://gist.github.com/Tblue/62ff47bef7f894e92ed5 (requires the lz4 package via pip or your package manager) -- the script appears to be python3 but is trivially adaptable to python2

              • There is a webextension available that should be able to open these. NB: while source is available, I have not verified it, and the permissions it requests are a bit concerning (especially the response to concerns)

              • In theory, you should be able to strip the first 8 bytes (e.g. with dd if=original.jsonlz4 of=stripped.lz4 bs=8 skip=1) and that should leave you with a valid lz4 block. Note that this is distinct from a lz4 frame. While most programming languages have libraries that can easily decode a block, finding a prebuilt tool to do so is more difficult, e.g. the liblz4-tool package only accepts the frame format.





              share|improve this answer
























                up vote
                4
                down vote













                Unfortunately, due to a non-standard header, standard tools won't work. There's an open proposal to change that. Apparently the Mozilla header was devised before a standard lz4 frame format existed; it does wrap a standard lz4 block.



                That said, the same bug report includes a few alternative methods. I'll list them briefly:



                • Use the dejsonlz4 tool, which includes binary builds for Windows and should be easy to build on *nix


                  • lz4json is a similar tool, but relies on an external liblz4 and is somewhat easier to build on *nix but harder on Windows (outside WSL)


                • Use this fairly simple Python script: https://gist.github.com/Tblue/62ff47bef7f894e92ed5 (requires the lz4 package via pip or your package manager) -- the script appears to be python3 but is trivially adaptable to python2

                • There is a webextension available that should be able to open these. NB: while source is available, I have not verified it, and the permissions it requests are a bit concerning (especially the response to concerns)

                • In theory, you should be able to strip the first 8 bytes (e.g. with dd if=original.jsonlz4 of=stripped.lz4 bs=8 skip=1) and that should leave you with a valid lz4 block. Note that this is distinct from a lz4 frame. While most programming languages have libraries that can easily decode a block, finding a prebuilt tool to do so is more difficult, e.g. the liblz4-tool package only accepts the frame format.





                share|improve this answer






















                  up vote
                  4
                  down vote










                  up vote
                  4
                  down vote









                  Unfortunately, due to a non-standard header, standard tools won't work. There's an open proposal to change that. Apparently the Mozilla header was devised before a standard lz4 frame format existed; it does wrap a standard lz4 block.



                  That said, the same bug report includes a few alternative methods. I'll list them briefly:



                  • Use the dejsonlz4 tool, which includes binary builds for Windows and should be easy to build on *nix


                    • lz4json is a similar tool, but relies on an external liblz4 and is somewhat easier to build on *nix but harder on Windows (outside WSL)


                  • Use this fairly simple Python script: https://gist.github.com/Tblue/62ff47bef7f894e92ed5 (requires the lz4 package via pip or your package manager) -- the script appears to be python3 but is trivially adaptable to python2

                  • There is a webextension available that should be able to open these. NB: while source is available, I have not verified it, and the permissions it requests are a bit concerning (especially the response to concerns)

                  • In theory, you should be able to strip the first 8 bytes (e.g. with dd if=original.jsonlz4 of=stripped.lz4 bs=8 skip=1) and that should leave you with a valid lz4 block. Note that this is distinct from a lz4 frame. While most programming languages have libraries that can easily decode a block, finding a prebuilt tool to do so is more difficult, e.g. the liblz4-tool package only accepts the frame format.





                  share|improve this answer












                  Unfortunately, due to a non-standard header, standard tools won't work. There's an open proposal to change that. Apparently the Mozilla header was devised before a standard lz4 frame format existed; it does wrap a standard lz4 block.



                  That said, the same bug report includes a few alternative methods. I'll list them briefly:



                  • Use the dejsonlz4 tool, which includes binary builds for Windows and should be easy to build on *nix


                    • lz4json is a similar tool, but relies on an external liblz4 and is somewhat easier to build on *nix but harder on Windows (outside WSL)


                  • Use this fairly simple Python script: https://gist.github.com/Tblue/62ff47bef7f894e92ed5 (requires the lz4 package via pip or your package manager) -- the script appears to be python3 but is trivially adaptable to python2

                  • There is a webextension available that should be able to open these. NB: while source is available, I have not verified it, and the permissions it requests are a bit concerning (especially the response to concerns)

                  • In theory, you should be able to strip the first 8 bytes (e.g. with dd if=original.jsonlz4 of=stripped.lz4 bs=8 skip=1) and that should leave you with a valid lz4 block. Note that this is distinct from a lz4 frame. While most programming languages have libraries that can easily decode a block, finding a prebuilt tool to do so is more difficult, e.g. the liblz4-tool package only accepts the frame format.






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Oct 4 at 1:16









                  Bob

                  43.4k19132167




                  43.4k19132167



























                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1363747%2fhow-to-decode-decipher-mozilla-firefox-proprietary-jsonlz4-format-sessionstor%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Popular posts from this blog

                      How to check contact read email or not when send email to Individual?

                      Bahrain

                      Postfix configuration issue with fips on centos 7; mailgun relay