Announcement

Collapse
No announcement yet.

JSON File Format

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

  • Aaron
    replied
    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.

    Leave a comment:


  • geolemon
    replied
    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.

    Leave a comment:


  • Chris
    replied
    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.

    Leave a comment:


  • geolemon
    replied
    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?

    Leave a comment:


  • Chris
    replied
    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

    Leave a comment:


  • kthulsidoss
    replied
    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

    Leave a comment:


  • Aaron
    replied
    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.

    Leave a comment:


  • yamoinca
    replied
    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.

    Leave a comment:


  • Chris
    replied
    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.

    Leave a comment:


  • bclaytonFI
    replied
    This looks very helpful but I'm not seeing any attachments.

    Leave a comment:


  • mateuscb
    replied
    Very nice! thanks for doing this, it is most helpful.

    Leave a comment:


  • Aaron
    replied
    Hello,

    Our external conversions do not support an automatic fallback since we need to inform users that the expected conversion failed, interactively or in a scripted solution. Changing to another format behind the scenes could lead to unexpected comparison results.

    We support defining multiple formats that match on the same extension in the Tools menu -> File Formats dialog. The topmost format is the one used automatically, while the other can be selected from the Text Compare's Format toolbar button dropdown if you need to switch.

    Leave a comment:


  • jkewley
    replied
    Fall back for failed compare

    One problem with the current solution is that it reports an error if the JSON files are unable to be parsed by jq.exe. Would be nice to allow plugins to provide a fall-back format (such as text) if the plugin fails. Sample attached that fails on compare.
    Attached Files

    Leave a comment:


  • Aaron
    replied
    Hello,

    While not in the box yet, we do have a JSON sorted format available for download in our Additional File Formats section:
    http://www.scootersoftware.com/downl..._moreformatsv4

    Leave a comment:


  • glahaye
    replied
    Indeed! JSON is one format that is essential these days. I was surprised when I learned BC didn't support it out of the box. This is a must have.

    Leave a comment:

Working...
X