jsoncrack.com icon indicating copy to clipboard operation
jsoncrack.com copied to clipboard

Edit JSON in Diagram View

Open naufalprakoso opened this issue 2 years ago • 7 comments

Feature

Currently, if we want to edit JSON, we need to edit the code editor on the left page. I think it easier if we can edit the JSON in Diagram View (right page after click one of diagram)

Alternative solutions or implementations

No response

Other context

No response

naufalprakoso avatar Sep 09 '22 06:09 naufalprakoso

+1. Jsoncrack already allows viewing content at json node, it would be very handy to enable this feature.

dennisdaotvlk avatar Sep 20 '22 02:09 dennisdaotvlk

Is anyone working on this? If not I would like to work on this feature

theogainey avatar Oct 02 '22 19:10 theogainey

Is anyone working on this? If not I would like to work on this feature

Hi, you could work on it

AykutSarac avatar Oct 03 '22 06:10 AykutSarac

I have started working on this issue and I have a questions. For starters here is a link to the branch I am working on. With my work so far as a user you can now edit the text of a graph node in the modal view and if your edit is valid JSON the graph node gets updated with that new text. ~~So my first question is as a user when I make an edit to the node and my edit is not valid JSON should I being seeing an Invalid JSON error?~~ (updated) I decided to add it.

The next question I have is about how to approach taking the new JSON from the node and updating the JSON editor with the new JSON. Currently when a user updates a node and it contains valid JSON the graph node gets updated. So now the text being displayed by the JSON editor is out of sync with the graph nodes. My first though would be that I need to add a parser function that turns the node and edge data back into JSON but I am wondering if a simpler method may exist. Any thoughts on this would be appreciated.

theogainey avatar Oct 03 '22 13:10 theogainey

@AykutSarac @theogainey I've checked the feature, and it works perfect. Thanks for implementing it.

We also can improve the editing process a little bit: instead of updating the JSON immediately, we'd rather have two buttons Save and Cancel, and update the JSON only on save. Also on save we can verify the entered value and show an error in case it's not valid.

dudarau avatar Oct 11 '22 09:10 dudarau

By the way, the implementation covers only Update, but not Create or Delete. If we need proper Editing, then we should think about the other two as well.

dudarau avatar Oct 11 '22 09:10 dudarau

This could be possible by setting the value at JSON using the node path in the Node's data now.

AykutSarac avatar Mar 08 '23 08:03 AykutSarac

This has been added now.

AykutSarac avatar May 21 '23 09:05 AykutSarac