Menu

#1069 JsonFormatter

None
pending
None
5
2021-08-05
2021-04-28
No

JsonFormatter 0.1.0
Source: https://github.com/thomasmey/JsonFormatter.git
Announcement: Initial Plugin Central release
Requires Java 8?
Requires jEdit ? probably very old version
Required third-party applications: jakarta.json:jakarta.json-api:2.0.0, org.glassfish;jakarta.json:2.0.0
Description: Utility to pretty print JSON

not sure about license for this plugin because of above third party dependencies and their licenses.

Discussion

  • Eric Le Lay

    Eric Le Lay - 2021-05-16

    Hello Thomas,
    this doesn't seem ready to release yet:
    - no license info
    - it should be integrated with the beauty plugin

     
  • Eric Le Lay

    Eric Le Lay - 2021-05-16

    And it only formats selection, not the whole buffer. Is this intended?

     
    • Thomas Meyer

      Thomas Meyer - 2021-08-05

      yes. I think it should be possible to add another if to try to format the whole buffer if there's no selection

       
  • Eric Le Lay

    Eric Le Lay - 2021-05-16

    textArea.setSelectedText(s, baos.toString()) is deprecated. Specify an encoding

     
  • Eric Le Lay

    Eric Le Lay - 2021-05-16

    My bad, it's not deprecated: it's just wrong. JsonWriter will choose utf-8 encoding. ByteArrayOutputStream.toString() will use whatever your platform has for default encoding.
    So, you should give JsonWriter a StringWriter to avoid this problem and the useless encoding/decoding from bytes.

     

    Last edit: Eric Le Lay 2021-05-16
  • Eric Le Lay

    Eric Le Lay - 2021-05-16

    In fact the Beauty plugin already has json pretty printing.
    What enhancement does your plugin provide?

     
    • Thomas Meyer

      Thomas Meyer - 2021-08-05

      Hi,
      how to use that mode? The plugin only seems to tell me: "Error: can't beatify this buffer because I don't know how to handle this mode".

       
      • Thomas Meyer

        Thomas Meyer - 2021-08-05

        wow! you first need to configure the plugin to use the json beautifer for json mode, to make it work... this is really a bad UX!

         
        • Dale Anson

          Dale Anson - 2021-08-05

          Oh, good idea! It shouldn't be hard to adjust the code to detect the mode and apply the appropriate formatter if one is available.

           
          • Dale Anson

            Dale Anson - 2021-08-05

            Actually, this looks like an oversight in Beauty, the default json formatter isn't set in the Beauty properties file like the rest of the built-in formatters, so it needs to be set manually at the moment.

             
    • Thomas Meyer

      Thomas Meyer - 2021-08-05

      maybe it's also a good idea to mention that the Beatuy plugin supports JSON formatting somewhere in the plugins description, because currently this is not "findable" by the Plugin-Manager, search for "json" brings up only JSLint plugin...

       
  • Eric Le Lay

    Eric Le Lay - 2021-08-05
    • status: open --> pending
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.