anyboxhq / everything-okjson

Submit your feature requests or bug reports here.
https://docs.okjson.app
Apache License 2.0
10 stars 0 forks source link

Please add editing support #30

Open MarqueIV opened 10 months ago

MarqueIV commented 10 months ago

Hi! Saw the other bug i filed was closed (and that main issue was fixed) and you're right... my tone may not have been the best tact to bring this up. As promised, I went ahead and reworded it to the below while also raising it from two to four stars, and I specifically called out how fast you were in addressing the needs. I also reworded the bulk in a more 'helpful' manner.

Since I wasn't sure you'd get notified on 'closed' issues here, I'm opening this new one with the revised/updated text. Same issues but I hope you agree a major improvement in its tone. That and I do hope you consider implementing some of the functionality I describe.

== Updated Review ==

TITLE: Impressive start, albeit missing a few key features that just keep it from being perfect five stars.

For quite a while., I've been looking for a simple, native JSON editor. Not one that was integrated into something like VS Code or other tools, but a true, native macOS app.

I came across this one in my search and it has the potential to fit that need perfectly! Easily one of the best-looking ones I've seen to date. It's clean, seems very performant, and has the ability to run custom scripts against the JSON, something not seen in most others.

However, there are a few nagging issues that keep it from receiving the five-star review that it's quite capable of becoming.

The first, and by far the biggest is when I installed it, the text editor was not working. It was simply blank. You could see the tree on the left as expected, but there is no 'raw JSON' view on the right.

However, if you noticed, I said 'was' not 'is' because I reached out to the developer and a new fix was posted literally in a couple days, which is a testament to good product support.

That said, there are still a few other things that would go a long way to making this truly great.

  1. It wasn't clear by the presentation, but this actually appears to be more of a viewer/formatter, but not an actual editor. What this means is while you can view the JSON in both tree and raw-formatted-text, the tree is read-only, and any changes you make in the raw text portion dont actually update the JSON. There's no way to save it back to the current document. (Note: There is a 'Save as' button although it appears to be non-functional. Perhaps this is behind the paywall since I'm using the free trial.) Still, being able to edit JSON files is the primary thing I need so perhaps it's unfair of me to judge this considering it's not actually touted as an 'editor.')

  2. An extension of the above point, there doesn't seem to be a way to simply create a new, blank JSON document. There's no 'File->New' support. You can only start from the pasteboard, a URL, a cURL response or by opening an existing file. I hope this capability is revisited, but it would again have to go hand-in-hand with true editing capabilities.

  3. Being that it appears to be designed primarily as a viewer/formatter-only app, it's not quite clear what the difference between 'Viewer' mode vs non-viewer mode is. Both are in the 'File' menu, and when activated appear to do the same thing (although the non-viewer ones are only enabled when the start-screen is shown. Perhaps these could be combined since they appear to do the same thing.

  4. The 'Zoom In Node' is a brilliant idea. It lets you 're-anchor' the 'tree view' to a child node so you're only seeing that node's contents both there, and in the plain JSON view. However, there's no way to 'un-zoom' outside of using the Undo command. This seems to imply it's actually destructively editing its internal representation of the JSON file itself although that is speculation on my part. I'm hoping this can be addressed in a future version that lets you 'delve down' as often as you want, while also letting you 'navigate back out' again whenever you want as well, not confined to the sequential nature of 'Zoom-then-undo'.

So again, in summary, this really has the potential to be the de-facto standard in native JSON editor. Gorgeous and simple UI, well-displayed highlighting and the scripting feature is briliant. But without even basic editing features like being able to save your changes, or even perform a file-new limits its usefulness. And again, clearing up somewhat-confusing viewer-vs-non-viewer views.

But if those things were addressed, few apps can touch the potential of this one. Let's hope the developer considers making these changes as quickly as they addressed the missing text editor. I for one would welcome the chance to revisit this app, and even actively promote it amongst my development peers.

4/5 Stars

francisfeng commented 10 months ago

I thought it was pretty clear that OK JSON is a formatter, as shown in the subtitle of Mac App Store: Scriptable JSON Formatter.

As for now, OK JSON is a better replacement for the countless online JSON formatters or browser extensions.

Almost all of the things you said were somehow related to the implementation detail of the app.

Take ”Zoom in Node” for example, it’s much simpler to store the original JSON string to a stack than to store the parsed nodes. It saves some memory as well.

I do have a lot of ideas for the editor. But even the current simple version had required a lot of work. You need to calculate the line number’s width and draw the line number view yourself. You need to implement syntax highlight, punctuation completion, etc.. Being native came at a cost.

If there will ever be a version 3.0, the main focus will be the editor. So far it will remain a JSON formatter.

MarqueIV commented 10 months ago

Yeah, it wasn't quite as clear to me it was a formatter-but-not-editor because formatting is a type of editing if you think about it. You're changing the JSON, or at least generating new JSON but it is different than the source.

But even if you didn't want to do a full editor now, why not simply make it non-read-only and treat edits the same as someone pasting in new JSON (at least when it looses focus as not to spam your formatter)? If you then allow us to save those changes back to the file, or back to the clipboard, that would be a more-than-acceptable workaround for most things.

You really could meet 90% of editing needs just by enabling those kinds of basic features with minimal effort on your part.

That said, it does sound like you have a plan for where you want to go next, so consider this suggestions from one developer to another. Again, you have one of the best looking JSON applications out there. I just hate that I have to switch between it and another app when all I'm looking to do is edit some simple value so I can test a setting or a config change.

Also, for what it's worth, I have a native Swift, strongly-typed anonymous JSON-parsing object model that I'd be more than happy to donate to the cause. Not sure if you've written your app in Swift, but if so, that would handle the object model cases for you easily. It's a single Swift file.

In the meantime, I'll keep an eye out for what you're up to next.

Also, feel free to mark this as closed/resolved. 🙂

francisfeng commented 10 months ago

If you open a file in OK JSON and edit it in the editor, you should be able to save it back to the file with the button.

If you open a JSON string from pasteboard, you can save the changes and copy it again.

OK JSON Save Changes