Get a CSV or similiar from Array JSON and vice versa

0 favourites
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • Hi there!

    I've got a question:

    I have an Array Object with the new Array Editor which stores all the dialogue of my game in a column for English and one for German Language. A variable switches which column is being called when dialogue is playing depending on the players language choice.

    Now, since i'll have this edited and proofread when everything is set and done i wanted to export the .JSON file as something easy to externally edit like a .csv file. I found some online converters but i'm not quite sure how they'll work and if it will be able to convert the CSV back to JSON after editing is done... So my question is, how to best go about it or should i rather use rex's CSV Plugin from the beginning?

    Is there a way to replace files in the File Menu of the Project window as well?

    Thanks for your suggestions!

    Joel

  • The simplest (recommended) way would be to use rex's plugin.

    The manual way to do it would be to make a few events to export and import csv yourself.

    You can use a loop for each element and the browser object's append to a file action, inserting commas and newlines in your loops where appropriate. To import it back in, you can parse the csv back in with tokenat. It is fairly straightforward, but probably not the easiest thing for a beginner.

  • Thanks for your Reply oosyrag

    With C3 you got the new Array Editor which generates a JSON File in the Editor that you call upon and load into an Array via AJAX. So basically i'd just need to be able to edit the JSON as a CSV or just in a Spreadsheet Software like Google Spreadsheets and reupload it again but i'm not sure how to go about it without breaking the JSON.

    Since the CSV Plugin was mainly for the convenience of editing Data in a Spreadsheet for me, with the new Array Editor i wouldn't really need it unless there's no way to get the Data out of C3 into a CSV or Excel and back again...

    Maybe Ashley has some advice?

  • Maybe submit a suggestion.

  • Ashley

    Sure but in the meantime how about this:

    Would there be a way to make the Editors behave more like Excel or Google Spreadsheet in that i could select multiple cells? Now, i don't know if this would be technically possible but wouldn't it be relatively easy to implement now that you can copy paste from the Array Editor over to something like Excel or Google Spreads? Was just thinking haha ^^

  • Maybe, but reinventing Excel in one corner of C3 is a rabbit hole I'd rather avoid going down.

  • Ashley Oh, comeon now, there might be untapped business opportunity here No worries though, i might just use the CSV Plugin by Rex and all's good.

    Thank you very much for taking the time to answer though!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Had some time to burn so I put this together if you're still interested - https://www.dropbox.com/s/of8uwu07mx2iq ... r.c3p?dl=0

    Load a csv or json file from local drive to import into a C3 array, and you can export again to json or csv.

    Basically does what rex's plugin does, without needing the plugin.

    It only works with 2 dimensional arrays though.

  • oosyrag : Wow, thank you so much this looks really helpful, i'll try it out when i get home tonight

  • Allright, i tried it out oosyrag and unfortunately i only get an Error Message when trying to load a file stating "Error: JSON is not a valid Construct array"...

  • Hm can you upload your json file for me to look at?

    I had it only accept arrays exported as the Array.Asjson expression, which tagged them as "c2array". Maybe if you saved directly from the new array editor the format may be slightly different. (I don't currently have access to it)

  • Interesting... looks like there are a lot more spaces in your file. I disabled the check for json file so it should work fine now. Can you confirm?

    Edit, used another method to perform the check. Should still work fine.

  • oosyrag :

    Woooow works perfectly now thank you so much!!!

    Thanks a ton oosyrag this is really handy and works beautifully

  • Are you talking about importing project files? When you import/upload a project file into your project and a file with the same name already exists, Construct 3 definitely asks you if you want to replace the file.

  • OOOOOOPS! Reading sure helps

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