Announcement

Collapse
No announcement yet.

JSON File Format

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Go to the Additional File Formats for BC4 page, click Windows, then enter json in the search box. Both JSON and JSON sorted file formats are available for download.
    Chris K Scooter Software

    Comment


    • #17
      This is nice but once in, I still have issues with alignment. See https://www.scootersoftware.com/vbul...brace-matching and yes I did send sample data via email previously.

      Comment


      • #18
        Hello,

        What issue are you having with the alignment? Per line or text within a line? Or is the Sort not Sorting your data correctly?
        If you can include updated screenshots with the forum thread, we can look into specifics. For finding an old email, you can re-email us with a link back to this forum thread and I can search on it. Looking through 2018 mentions of "JSON" and I'm not seeing example attachment files. If you can also include the files and a full screen screenshot showing the problem, we'll be able to recreate it and figure this out.
        Aaron P Scooter Software

        Comment


        • #19
          Hi needed a help on large file sizes for JSON , does scooter software support 100 mb JSON file .. it need not be line by line comparision

          Comment


          • #20
            Beyond Compare should be able to compare 100 MB JSON files when using the JSON file format from the Additional File Formats page. The JSON Sorted file format uses an external utility to sort JSON before comparison, we haven't tested that format with files as large as 100 MB.

            Beyond Compare runs as a fully functional trial for 30 days before it requires a license key, with files as large as you describe it's a good idea to test BC with your files before purchase.

            The JSON and JSON Sorted file formats can be downloaded here:
            https://www.scootersoftware.com/down..._moreformatsv4
            Chris K Scooter Software

            Comment


            • #21
              Am I correct that this additional formats are not possible to add, if you are working on BC4 that was installed with the "portable installation" option?

              I'm not local admin on the work laptop, and I'm trying to work through the internal politics associated with our BC3 contract and my need to evaluate BC4 for JSON. So I have attempted to work around this by using the portable installation option, but when I download the Windows JSON formats and try to install the bcpckg, I get an error dialog "Import file has an unsupported format". I've tried several permutations of JSON formats, they all do the same. I am suspecting my installation option. Or possibly is this because I'm in the 30 day evaluation period/mode?

              Comment


              • #22
                File formats can be imported into portable installs and into trial versions of Beyond Compare.

                File formats are version specific, so make sure you're importing the version 4 file format into Beyond Compare 4. If you try to import a version 4 format into Beyond Compare 3, it will fail with the error message you listed.

                Double clicking on a file format .bcpkg file will import into the version of Beyond Compare that is installed system wide. To import into your portable install of Beyond Compare 4, run version 4, then select Tools > Import Settings and navigate to the file format bcpkg.
                Chris K Scooter Software

                Comment


                • #23
                  Thanks Chris, that absolutely worked.

                  By default, it appears the JSON Sorted won't actually sort entirely through the tree, the sorting seems to only occur at the root level - this makes sense because that sort is by keys, according to the manual. My problem is that we often need to compare JSON that contains an unsorted sub-arrays, so I need to sort everything, not just by the outer keys.
                  Prior to this, I've used the JQ online tutorial and editor to successfully sort using the JQ built-in "walk" function:
                  Code:
                  walk( if type == "array" then sort else . end ) 
                  I'll do some digging myself, but if you can advise if there is a way to modify the JQ code that is used for processing, to build in that walk function, into a format?

                  EDIT:
                  I've been playing with the lines in the JSON_sorted.bat file, and I think I figured it out.

                  Here was the default syntax in the BAT file to start with:
                  Code:
                  if "%PROCESSOR_ARCHITECTURE%"=="AMD64" then (
                  Helpers\Json\jq64.exe -S . < %1 > %2
                  ) else (
                  Helpers\Json\jq.exe -S . < %1 > %2
                  )


                  After playing around with this for a little while and referencing the manual I figured this out - for Windows I needed to wrap my code with double-quotes, and release the inner double quotes with backslashes - and replaced the "-S ." with my code instead:
                  Code:
                  if "%PROCESSOR_ARCHITECTURE%"=="AMD64" then (
                  Helpers\Json\jq64.exe "walk( if type == \"array\" then sort else . end )" < %1 > %2
                  ) else (
                  Helpers\Json\jq.exe "walk( if type == \"array\" then sort else . end )" < %1 > %2
                  )


                  Is there any way that I could save this into my own format, rather than hack the BAT file? Then I could continue to use the default "JSON sorted" as well, if I can?
                  Last edited by geolemon; 09-Jan-2020, 01:18 PM.

                  Comment


                  • #24
                    Hello,

                    You certainly can. Edit the name of the format you've edited to be something else in the Tools menu -> File Formats list. When you import the download, it will use the original name, and you can then have both. Whichever is higher in the File Formats list is the format that first matches the extension and is used automatically. The other can be selected from the small dropdown arrow next to the File Format toolbar button after loading into a comparison (to update both sides at once), or click the Format name in each pane (to update a single side), or update in the Session Settings, Format tab.
                    Aaron P Scooter Software

                    Comment

                    Working...
                    X