Title: Destroyed JSON data structure
Last modified: August 30, 2016

---

# Destroyed JSON data structure

 *  Resolved [martijnn94](https://wordpress.org/support/users/martijnn94/)
 * (@martijnn94)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/destroyed-json-data-structure/)
 * Hi,
 * Recently we pushed a database to a production environment without knowing about
   the following issue:
 * [https://wordpress.org/support/topic/javascript-errors-and-disappearing-columns?replies=8](https://wordpress.org/support/topic/javascript-errors-and-disappearing-columns?replies=8)
 * Now I checked the database and the saved data is indeed manipulated after the
   database migration.
 * There have been so many changes in production that discarding the database is
   not much of an option.
 * Now I was wondering if it’s possible to restore the data in the database with
   some function or JSON formatting? Then I could just create a loop to fix all 
   database entries. I hope someone can guide me in the right direction for this.
 * If needed I can post the difference in the JSON data of before and after the 
   migration.
 * Oh and thanks for creating this awesome plugin!
 * Thanks in advance!
 * [https://wordpress.org/plugins/advanced-custom-fields-table-field/](https://wordpress.org/plugins/advanced-custom-fields-table-field/)

Viewing 15 replies - 1 through 15 (of 21 total)

1 [2](https://wordpress.org/support/topic/destroyed-json-data-structure/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/destroyed-json-data-structure/page/2/?output_format=md)

 *  Plugin Author [Johann Heyne](https://wordpress.org/support/users/jonua/)
 * (@jonua)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/destroyed-json-data-structure/#post-6809810)
 * I´m sorry for this nasty problem. And yes, please drop me some JSON data of before
   and after the migration. This would help me to get quick into it.
 * Thanks!
 *  Plugin Author [Johann Heyne](https://wordpress.org/support/users/jonua/)
 * (@jonua)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/destroyed-json-data-structure/#post-6809811)
 * I´m sorry for this nasty problem. And yes, please drop me some JSON data of before
   and after the migration. This would help me to get quick into it.
 * Thanks!
 *  Thread Starter [martijnn94](https://wordpress.org/support/users/martijnn94/)
 * (@martijnn94)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/destroyed-json-data-structure/#post-6809815)
 * Hi,
 * Thanks for your help!
 * The correct structured JSON:
 * Image of backend: [http://i.imgur.com/N1D3ij0.png](http://i.imgur.com/N1D3ij0.png)
 * `{"p":{"o":{"uh":1}},"c":{"0":{"p":""},"1":{"p":""}},"h":{"0":{"c":"Technische
   gegevens"},"1":{"c":""}},"b":{"0":{"0":{"c":"Minimale / Maximale opspan inwendig"},"
   1":{"c":"14” – 56”"}},"1":{"0":{"c":"Maximale band breedte\t"},"1":{"c":"1.220
   mm"}},"2":{"0":{"c":"Maximale band diameter"},"1":{"c":"2.450 mm"}},"3":{"0":{"
   c":"Vermogen"},"1":{"c":"1,5 kW"}},"4":{"0":{"c":"Maximaal gewicht band / wiel"},"
   1":{"c":"1.100 kg"}},"5":{"0":{"c":"Maximale kracht afdruk rol"},"1":{"c":"25.500
   N"}}}}`
 * Correct JSON (linted):
 *     ```
       {
       	"p": {
       		"o": {
       			"uh": 1
       		}
       	},
       	"c": {
       		"0": {
       			"p": ""
       		},
       		"1": {
       			"p": ""
       		}
       	},
       	"h": {
       		"0": {
       			"c": "Technische gegevens"
       		},
       		"1": {
       			"c": ""
       		}
       	},
       	"b": {
       		"0": {
       			"0": {
       				"c": "Minimale / Maximale opspan inwendig"
       			},
       			"1": {
       				"c": "14” – 56”"
       			}
       		},
       		"1": {
       			"0": {
       				"c": "Maximale band breedte\t"
       			},
       			"1": {
       				"c": "1.220 mm"
       			}
       		},
       		"2": {
       			"0": {
       				"c": "Maximale band diameter"
       			},
       			"1": {
       				"c": "2.450 mm"
       			}
       		},
       		"3": {
       			"0": {
       				"c": "Vermogen"
       			},
       			"1": {
       				"c": "1,5 kW"
       			}
       		},
       		"4": {
       			"0": {
       				"c": "Maximaal gewicht band / wiel"
       			},
       			"1": {
       				"c": "1.100 kg"
       			}
       		},
       		"5": {
       			"0": {
       				"c": "Maximale kracht afdruk rol"
       			},
       			"1": {
       				"c": "25.500 N"
       			}
       		}
       	}
       }
       ```
   
 * The wrongly structured JSON after migration:
 * Image of backend: [http://i.imgur.com/pbS8HOh.png](http://i.imgur.com/pbS8HOh.png)
 * `{"p":{"o":{"uh":1}},"c":[{"p":""},{"p":""}],"h":[{"c":"Technische gegevens"},{"
   c":""}],"b":[[{"c":"Minimale \/ Maximale opspan inwendig"},{"c":"14\u201d \u2013
   56\u201d"}],[{"c":"Maximale band breedte\t"},{"c":"1.220 mm"}],[{"c":"Maximale
   band diameter"},{"c":"2.450 mm"}],[{"c":"Vermogen"},{"c":"1,5 kW"}],[{"c":"Maximaal
   gewicht band \/ wiel"},{"c":"1.100 kg"}],[{"c":"Maximale kracht afdruk rol"},{"
   c":"25.500 N"}]]}`
 * Wrong JSON (linted):
 *     ```
       {
       	"p": {
       		"o": {
       			"uh": 1
       		}
       	},
       	"c": [{
       		"p": ""
       	}, {
       		"p": ""
       	}],
       	"h": [{
       		"c": "Technische gegevens"
       	}, {
       		"c": ""
       	}],
       	"b": [
       		[{
       			"c": "Minimale \/ Maximale opspan inwendig"
       		}, {
       			"c": "14\u201d \u2013 56\u201d"
       		}],
       		[{
       			"c": "Maximale band breedte\t"
       		}, {
       			"c": "1.220 mm"
       		}],
       		[{
       			"c": "Maximale band diameter"
       		}, {
       			"c": "2.450 mm"
       		}],
       		[{
       			"c": "Vermogen"
       		}, {
       			"c": "1,5 kW"
       		}],
       		[{
       			"c": "Maximaal gewicht band \/ wiel"
       		}, {
       			"c": "1.100 kg"
       		}],
       		[{
       			"c": "Maximale kracht afdruk rol"
       		}, {
       			"c": "25.500 N"
       		}]
       	]
       }
       ```
   
 * Seems like the ID’s of the rows are missing?
 * Thanks
 *  Plugin Author [Johann Heyne](https://wordpress.org/support/users/jonua/)
 * (@jonua)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/destroyed-json-data-structure/#post-6809818)
 * Thanks. This problem in based on an misconception on mine. JSON only allows a
   string to be a key, but I used digits like “0” as key´s. So the migration tool
   fix this. Unfortunately, my code is not prepared for this. So I´m trying to fix
   this in the next release. But December is as usually a busy month for me. I try
   to get my hands on in the next 24 hours.
 *  Thread Starter [martijnn94](https://wordpress.org/support/users/martijnn94/)
 * (@martijnn94)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/destroyed-json-data-structure/#post-6809961)
 * You are awesome! If you need any help with something, please let me know!
 *  Plugin Author [Johann Heyne](https://wordpress.org/support/users/jonua/)
 * (@jonua)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/destroyed-json-data-structure/#post-6809965)
 * I just finished a patch version of the plugin, that uses the correct JSON format
   to read and save data but also can read the previously used format. It needs 
   some tests know and then I would ask you, if you can try the new version before
   I role it out.
 *  Thread Starter [martijnn94](https://wordpress.org/support/users/martijnn94/)
 * (@martijnn94)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/destroyed-json-data-structure/#post-6809966)
 * Epic, so it also reads the by a migration malformed data?
 * Of course I would like to test, do you have the plugin available on Github or
   something? Will try first thing tomorrow!
 *  Plugin Author [Johann Heyne](https://wordpress.org/support/users/jonua/)
 * (@jonua)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/destroyed-json-data-structure/#post-6809969)
 * [https://github.com/johannheyne/acf-table/tree/_masters/free](https://github.com/johannheyne/acf-table/tree/_masters/free)
   
   Please make a backup of your database before you test the new version. Replace
   your plugin files with the files in the folder /advanced-custom-fields-table-
   field/trunk/
 *  Plugin Author [Johann Heyne](https://wordpress.org/support/users/jonua/)
 * (@jonua)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/destroyed-json-data-structure/#post-6809993)
 * And yes, it should also reads the by a migration “malformed” data.
 *  Thread Starter [martijnn94](https://wordpress.org/support/users/martijnn94/)
 * (@martijnn94)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/destroyed-json-data-structure/#post-6809994)
 * Hi,
 * Was just testing this out, seems to be working perfectly. I’m going to push to
   acceptiation in a few moments to also test on non-malformed data!
 *  Thread Starter [martijnn94](https://wordpress.org/support/users/martijnn94/)
 * (@martijnn94)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/destroyed-json-data-structure/#post-6810005)
 * Just pushed to production and everything seems fine! I’ll have the client play
   with it to see if something goed wrong, but I dont think it will.
 * Thanks again for your fast help!
 *  [formagenda](https://wordpress.org/support/users/formagenda/)
 * (@formagenda)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/destroyed-json-data-structure/#post-6810085)
 * I can confirm that this is actually also part of fixing this old issue (which
   turned out not to be server-related at all, now).
    [https://wordpress.org/support/topic/fields-being-deleted-on-save?replies=6](https://wordpress.org/support/topic/fields-being-deleted-on-save?replies=6)
 * We had to dig up the project again this week, and make adjustments to it, then
   migrate it to test and live – And it was causing the exact issue, again.
 * I installed 1.1.5, and tried a new migration to test. All tables are intact.
 *  Plugin Author [Johann Heyne](https://wordpress.org/support/users/jonua/)
 * (@jonua)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/destroyed-json-data-structure/#post-6810086)
 * Thanks!
 *  [formagenda](https://wordpress.org/support/users/formagenda/)
 * (@formagenda)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/destroyed-json-data-structure/#post-6810087)
 * I’ll have to take back that confirmation – Yes, it does work when migrating from
   my local to test (Digital Ocean) server – But going live (not a Digital Ocean
   server) is not migrating the tables correctly, unfortunately.
 * I don’t want to hijack another thread though, just a heads up.
 *  Plugin Author [Johann Heyne](https://wordpress.org/support/users/jonua/)
 * (@jonua)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/destroyed-json-data-structure/#post-6810088)
 * Can you please give me a sample snippets of the table data in the database before
   and after migration?

Viewing 15 replies - 1 through 15 (of 21 total)

1 [2](https://wordpress.org/support/topic/destroyed-json-data-structure/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/destroyed-json-data-structure/page/2/?output_format=md)

The topic ‘Destroyed JSON data structure’ is closed to new replies.

 * ![](https://ps.w.org/advanced-custom-fields-table-field/assets/icon-256x256.png?
   rev=1962986)
 * [Table Field Add-on for ACF and SCF](https://wordpress.org/plugins/advanced-custom-fields-table-field/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-custom-fields-table-field/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-custom-fields-table-field/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-custom-fields-table-field/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-custom-fields-table-field/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-custom-fields-table-field/reviews/)

 * 21 replies
 * 3 participants
 * Last reply from: [Johann Heyne](https://wordpress.org/support/users/jonua/)
 * Last activity: [10 years, 6 months ago](https://wordpress.org/support/topic/destroyed-json-data-structure/page/2/#post-6810099)
 * Status: resolved