CorentinTh / it-tools

Collection of handy online tools for developers, with great UX.
https://it-tools.tech
GNU General Public License v3.0
21.71k stars 2.6k forks source link

[TOOL IMPROVEMENT] JSON diff formatting large values #434

Open roland-d opened 1 year ago

roland-d commented 1 year ago

Describe the solution you'd like Today I tried the JSON diff and at first it looked like nothing had happened. After looking around I found out that the diff did actually happen but just the output was suboptimal. That happens because the JSON contains some large values and that pushes everything off screen.

Example first JSON:

{
  "phpSettings": {
    "disable_functions": "getmyuid,passthru,leak,listen,diskfreespace,tmpfile,link,ignore_user_abort,shell_exec,dl,set_time_limit,exec,system,highlight_file,source,show_source,fpassthru,virtual,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,proc_open,proc_close,proc_nice,proc_terminate,escapeshellcmd,ini_alter,popen,pcntl_exec,socket_accept,socket_bind,socket_clear_error,socket_close,socket_connect,symlink,posix_geteuid,ini_alter,socket_listen,socket_create_listen,socket_read,socket_create_pair,stream_socket_server",
    "display_errors": false,
    "file_uploads": true,
    "iconv": true,
    "magic_quotes_gpc": false,
    "max_input_vars": "1000",
    "mbstring": true,
    "open_basedir": "xxxxxx",
    "output_buffering": true,
    "register_globals": false,
    "safe_mode": false,
    "session.auto_start": "0",
    "session.save_path": "",
    "short_open_tag": false,
    "xml": true,
    "zip": true,
    "zlib": true
  }
}

Example second JSON:

{
  "phpSettings": {
    "disable_functions": "",
    "display_errors": false,
    "file_uploads": true,
    "iconv": true,
    "magic_quotes_gpc": false,
    "max_input_vars": "1000",
    "mbstring": true,
    "open_basedir": "",
    "output_buffering": true,
    "register_globals": false,
    "safe_mode": false,
    "session.auto_start": "0",
    "session.save_path": "",
    "short_open_tag": false,
    "xml": true,
    "zip": true,
    "zlib": true
  }
}

This is what I see as output: image

Additional context I understand the issue now, as it is because of the phpSettings node but it would be nice if we can take such long values into account.

These JSONs are part of a much larger JSON but made smaller to understand it easier.

CorentinTh commented 1 year ago

Related to #413