Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to export a Json file with phpAdmin without COMMENTS (// ..... */)

Tags:

json

php

I have a .json file exported with phpAdmin tool. My problem is that json is invalid.... I ask me how is possible that Phpadmin exports a Json file that is not correct? Comments in my file are the biggest problem. Please help me because when I attach this .json they tell me that this json is Invalid. And Firebase can't use this.

like image 231
Pancrazio Schito Avatar asked May 25 '26 13:05

Pancrazio Schito


1 Answers

It seems you can't ignore the comment generation in JSON format, if you have access to the phpMyAdmin source code on your server you can remove the comment generation yourself pretty easily in the file

phpMyAdmin/libraries/plugins/export/ExportJson.php

see the exportHeader function and for the other comments just search the file for // (it's not that long).

If you don't have access to the phpMyAdmin source code you may be able to remove the comments after the file creation (either manually or with a program on your computer if you just need it once or a few times). You can use two regular expressions for that, if you need further help I can post an example.

like image 174
xander Avatar answered May 28 '26 04:05

xander



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!