The array editor appears to "inflate" json files

0 favourites
  • 4 posts
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • Just noticed that the (excellent) C3 array editor inserts dozens of whitespaces after/before every character in the relevant json file- this can be easily noticed simply downloading the edited json file (or exporting it with the whole C3 project) and opening it with notepad or any text editor.

    I 'm not a tech guy, so maybe this is perfectly normal, but none of the other arrays editor I know behave this way.

    The exported file is, of course, perfectly correct & working - but it has become hardly readable / manually editable

    (quite annoying but ok, only for some use).

    Another (perhaps worse) drawback is that file seems to has become much bigger: I imported in C3 a json file related to a medium bidimensional array [100, 5, 1], almost empty (size: 2.5 KB), edited just one cell, downloaded the json file, and it had become 25 kb (26 kb in the exported apk).

    This maybe not totally negligible for projects with many and/or big arrays.

    If anyone is interested, the quickiest workaround I found is to open the exported files with Notepad++, then run its "Replace" function with parameters:

    Search Mode = Regular Expression

    Find What = ^/S*

    Replace With =blank.

    This deletes all the whitespaces restoring the "normal" aspect of the file and its size - works perfectly to me.

    After this, you can reimport the file on C3.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • intresting detail but 25kb today is nothing, ¿why dont you create a full array with data and compare with the same in c2 and upload the results?

  • Hey MassimoF, I'm the developer for the ArrayEditor. I'm glad you like it!

    Could you show me an example of what you mean? I don't think it's a bug but it's best to check. We "pretty print" JSON files when we save them, it's supposed to make it more readable, but with the 3D arrays we use it can spread the file out quite thinly ( one value per line ). We used to export in the more compact format, but we had a request from a user to change it to a pretty printed format. They were using version control and when all the content is on one line it's very hard to use file diffing, as it basically shows the entire file as changed if a single character is changed.

    The extra whitespace is ignored by the parser so it's purely for human eyes only. Incidentally I tried creating an empty 200 x 5 x 1 array and downloading it, and while it came to 152kB loose it compresses very well. Using DEFLATE which is what c3p and apk files uses it was only 985 bytes. Minified the file was 20kB loose and 167 bytes compressed. Perhaps we should offer some option for minifying JSON files during export.

    I'd be careful using that regex for removing whitespace, as it would remove any spaces in your values as well! There's quite a few JSON minifiers/beautifiers around which will safely change your content for you. Here's one

  • Hi Nepeo,

    I was editing some arrays in C3, to export to use later in C2, and since I like to give a look into them <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    I noticed the difference in their format.

    Find below an example (before / after). The "before" file was created via a dedicated C2 capx, and the "after" one

    is the same file edited (only one cell) via C3 and then downloaded. I'm using the desktop version of C3

    on a Win7-64 PC. ... hyUwjZIgKy ... IhRuqPioct

    Btw, thx for you advice (anyway, I have no blanks in my values), and for the link, very


Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)