Menu

New feature for your consideration: JSON Export File Format

2026-03-20
2026-03-31
  • Ronald W. Henderson

    I have extended the Export file format to now include JSON data output encoding. I did the best that I could for translating XML to JSON object names and key:values pairs. This new feature comes with extensive testing.

    Notes:
    1) The Export file format type is now a selection in the Preference dialog.
    2) I tested output for these 3 cases: USR1 signal, Export manually and End of a capture read file.
    3) A new Preference dialog image in png and eps are attached.
    4) Docbook updates include the new Export file format selection, Different ways to Export data, and an example JSON output appendix.
    5) All JSON testing was performed using the jq JSON parser.
    6) I updated the etherape.pot file for new string descriptions.
    7) I am not sure if you guys update the etherape.pot manually or with a tool. I did it manually.
    8) I updated one translation for italian (it.po).

     

    Last edit: Ronald W. Henderson 2026-03-20
    • R. Ghetta

      R. Ghetta - 2026-03-21

      Good idea! Nowadays json is used everywhere, supporting this will be very useful indeed.
      Thank you!
      There are some points to improve, however:

      • I believe there is a bug in node_id_json: in tcp mode, ip and port should be joined with a comma, not a space (it worked ok in xml because it was surrounded by tags)
      • generate_json doesn't seem to gfree all the strings used, only jsonh and oldlocale
      • while I think it's unlikely that service/ip names would contain invalid json characters, the dumper would be more robust if it would check the output strings and escape json reserved chars (like \, ", control chars ...)
      • this is really a nitpick: while the existing code mostly complies with C89, esp. in regard to variables declaration, I think we can now safely assume at least C99.
        So I´d prefer to have variables declared at point of usage, not at the start of the block

      Again, thank you!
      Riccardo

       
  • Ronald W. Henderson

    Riccardo:
    Thanks for your comments. I will take into account of all your concerns. Let me correct and improve the code and then I will resubmit.

    ---Ron Henderson

     
  • Ronald W. Henderson

    Revised Patch Commit:

    Notes:
    1) Fixed node_id_json() - Mode: TCP -> A use case I did not consider for JSON export.
    2) generate_json() now properly gfree's all allocated char pointer references.
    3) A new json_escape() method was introduced that: Handles: ", \, \b, \f, \n, \r, \t and all control characters (0-31) for safe JSON encoding. Any exported JSON string data now uses this method.
    4) All newly add functions will adhere to C99 with variables declared at point of usage. I went back and revised.
    5) I added an Icon to the "Export" menu entry. The File pull down menu column now looks cleaner.
    6) Once again I updated translations for Italian only.

    See attached patch file: "etherape-0.9.22_json2.diff" for all changes. Please use the image files attached previously.

    ---Ron Henderson

     

Log in to post a comment.

MongoDB Logo MongoDB