Title: JSON format
Last modified: June 20, 2017

---

# JSON format

 *  Resolved [xucaen](https://wordpress.org/support/users/xucaen/)
 * (@xucaen)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/json-format-2/)
 * We have over 20k rows of data in Tablepress currently and expect to import thousands
   of rows of data each month. Using the built in Import is too slow and does not
   have any kind of error checking for our data (of course not, how could tablepress
   possible know of our data validation needs? 😉 So using import files is not an
   option for us.
 * In an effort to speed things up and ensure our data is validated before importing,
   I am designing a program to read the data from a spread sheet and update the 
   MySQL table directly. In order to do that, I must first read in the current data
   from MySQL and parse it. That part I have working so far. The trouble I am having
   is when I go to save the date back to MySQL, I must first serialize my data and
   the JSON lib I am using formats it differently than Tablepress.
 * Example: Tablepress formats the JSON like this:
 * [[“col1”, “col2”, “col3”],
    [“test1”, “test2”, “test3”], [“dog”, “cat”, “bird”]]
 * JSON serializer I am using formats the JSON like this:
 * [{“col1″:”test1″,”col2″:”test2″,”col3″:”test3”},
    {“col1″:”dog”,”col2″:”cat”,”
   col3″:”bird”}]
 * My question is: will TablePress be able to understand and use the second JSON
   format (which I understand from my searches on the internet to be the “official”
   way to do JSON)? If not, do you have any recommendations or code samples for 
   how to format the JSON so that TablePress can understand and use it?
 * Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/json-format-2/#post-9245359)
 * Hi,
 * thanks for your post, and sorry for the trouble.
 * There’s no “official” way of doing JSON, these are just different data structures,
   that are represented differently 🙂
    Your structure is an array of objects, whereas
   TablePress requires an array of arrays. Now, due to some awareness of errors,
   TablePress might actually understand your format, but I would not count on it.
   Instead, you should make sure that the data your JSON-ifying is an array of arrays.
   Your JSON lib will do that automatically, if you pass the proper input data, 
   I’m quite sure. What programming language are you using here?
 * Regards,
    Tobias
 *  Thread Starter [xucaen](https://wordpress.org/support/users/xucaen/)
 * (@xucaen)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/json-format-2/#post-9245996)
 * I am using Newtonsoft, and I can not find any way to make it serialize the data
   like Tablepress wants it. It seems that Newtonsoft insists on using curley braces
   and objects rather than a simple array, so I wrote my own function that builds
   it.
 * Thanks,
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/json-format-2/#post-9246038)
 * Hi,
 * that would be strange. Especially if you are really passing an array of arrays
   to the JSON-ify function. So, you might have to check what data type you are 
   passing to the function.
 * Regards,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘JSON format’ is closed to new replies.

 * ![](https://ps.w.org/tablepress/assets/icon.svg?rev=3192944)
 * [TablePress - Tables in WordPress made easy](https://wordpress.org/plugins/tablepress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/tablepress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/tablepress/)
 * [Active Topics](https://wordpress.org/support/plugin/tablepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tablepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tablepress/reviews/)

## Tags

 * [json](https://wordpress.org/support/topic-tag/json/)
 * [MySQL](https://wordpress.org/support/topic-tag/mysql/)

 * 3 replies
 * 2 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [8 years, 11 months ago](https://wordpress.org/support/topic/json-format-2/#post-9246038)
 * Status: resolved