it-tools icon indicating copy to clipboard operation
it-tools copied to clipboard

[TOOL IMPROVEMENT] JSON diff formatting large values

Open roland-d opened this issue 2 years ago • 2 comments

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.

roland-d avatar Jun 05 '23 17:06 roland-d

Related to #413

CorentinTh avatar Jun 05 '23 18:06 CorentinTh

Hi @roland-d , fixed in https://sharevb-it-tools.vercel.app/json-diff

And if you are interested in an up to date version of it-tools, with many improvements, new tools, and bug fixes, as this repo is almost no more maintained, I made a fork here : https://github.com/sharevb/it-tools (https://sharevb-it-tools.vercel.app/ and docker images https://github.com/sharevb/it-tools/pkgs/container/it-tools)

sharevb avatar Dec 07 '25 21:12 sharevb