• Resolved milanbatinic

    (@milanbatinic)


    Hi!

    I have some issues to deal with when working with JSON.

    When importing JSON file, keys that have multiple values ( multiple values are saved as arrays in JSON file ) are lost as well as values themselves.

    I have a JSON file with swedish characters. Everything works fine when importing it into table, swedish characters are showing as they should. Then i do some editing in table, save, and when exporting that same table back to JSON file swedish characters are lost. What could be the reason for that happening?

    When exporting JSON file that is created has different format comparing to JSON file that i imported. The exported file is an object of arrays while the imported JSON is an array of objects. Exported file has no key:value pairs as the one i imported.

    I would also need to eliminate key:value pairs from begining of exported JSON file ( “id”:”11″,”name”:”Copy of partnerssweden.json”,”description”:”partnerssweden.json”,”author”:”1″,”last_modified”:”2022-09-19 10:46:16″,”data”: …)

    Is there a way to controll the format of JSON file that gets exported?

    Is it possible to change the function of the save button so that it saves table into a JSON file on my website?

    Regards
    Milan

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    TablePress only understands its own JSON format structure, I’m afraid. That is, either a full object, including that meta data that you mention, or just the data property, as a two-dimensional array.

    Thus, it’s actually a bit of luck that your initial format gets imported into a table. It’s however not possible to maintain that format.

    You could maybe look into using the tablepress_export_data plugin filter hook to re-format the format according to your needs.

    As for the lost Swedish characters. That sounds strange. TablePress (and normally also JSON) use UTF-8 as the character encoding, so I can only imagine that something else on the site is maybe changing the character encoding?

    Regards,
    Tobias

    Thread Starter milanbatinic

    (@milanbatinic)

    Hi!

    I will look into tablepress_export_data, thanks for that.

    When i export that same table into CSV, swedish characters are preserved. So i guess it has something to do with how JSON export is interpreting swedish characters.

    Regards,
    Milan

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    that would be strange. Normally, they would also be encoded as UTF-8 entities in the JSON format. If you find something, please let me know.

    Regards,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Exporting to JSON’ is closed to new replies.