JSON data is increasingly becoming the standard for interchange between components and systems. Often JSON is stored in a database column, either in a large text/clob style field or in one that is explicitly declared as JSON. It would be helpful to be able to directly view/edit JSON within ADS.
1) On right mouse of a grid result field, you could add "View in JSON viewer..." to the "View Cell in...". It would then be helpful to have the option in the JSON viewer either to automatically or on command "pretty format" the JSON. Collapsing JSON sections, outline of JSON or any more sophisticated view/edit features would be "nice to have".
2) On the result grid, Copy As, could render a single row as a JSON object or render selected rows (or the entire resultset) as an array of JSON objects.
3) ADS Menu File/New could offer a JSON editor.
I'm sure your team has already considered the possibility of JSON support in some form. I'm just adding my request and some specific suggestions.
120 KB
33 KB
76 KB
118 KB
131 KB
97 KB
93 KB
134 KB
108 KB
998 KB
99 KB
Case #00632088
Ivan opened a case asking for the same thing, see below.
"Hello,
I am not able to find any way to edit single document of MongoDB in ADS.
Every other mongodb IDE has this simplest functionality (robomongo, studio3t).
What is needed
- Execute simple search db.testcollection.find({_id:123})
- Select document in results, edit json and save it back.
The only option to edit I found is: "Edit collection data (top 1000)", that is completely unusable.
It is not possible to apply query for this top 1000, most of the times IDE throws out of memory error, no way to edit document that is sorted after these 1000.
This is high prior issue.
Waiting for the fix on your side.
ADS details:
Licensed to The Goldman Sachs Group, Inc.
Enterprise License
Aqua Data Studio 18.0.18
Build #: 55109
Built on: 2017-Jul-12 02:09:22 PM"
Note that this enhancement is NOT limited to MongoDB. It should be enabled for all databases.
Note that this enhancement is NOT limited to MongoDB. It should be enabled for all databases.
Implemented this issue as suggested by nihlam , and pushed the code for the same.
[Nhi] I've updated my above comment.
Updated code as per comment
Implemented this issue as suggested by nihlam , and pushed the code for the same.
[Nhi] I've updated my above comment.
Updated code as per comment
unit tests :
1) select any collection from MongoDB, Right click on the collection and select Edit Collection Data.
unit tests :
1) select any collection from MongoDB, Right click on the collection and select Edit Collection Data.
Hi Nhi,
Fixed the issue for "view as json" right click menu.
Thanks, Bhagyashree
Hi Nhi,
Fixed the issue for "view as json" right click menu.
Thanks, Bhagyashree
SVN r56012
-- ResultSetTablkeViewUtil > line #488
String text = obj.toString();
should be
String text = JsonFormat.getPrettyJson(obj);
This avoids converting to JSON string twice.
SVN r56012
-- ResultSetTablkeViewUtil > line #488
String text = obj.toString();
should be
String text = JsonFormat.getPrettyJson(obj);
This avoids converting to JSON string twice.
Hi Asif,
I will do the changes as per your comment.
Thanks,
Bhagyashree
Hi Asif,
I will do the changes as per your comment.
Thanks,
Bhagyashree
Hi Asif,
Checked in the code for the changes suggested by you.
Thanks,
Bhagyashree
Hi Asif,
Checked in the code for the changes suggested by you.
Thanks,
Bhagyashree
-- ResultSetTablkeViewUtil > line #524
Please debug the code under, if (obj instanceof ResultsDiffValue) block. Few things are not looking right there.
if (value instanceof String) { text = ((ResultsDiffValue) obj).toString(); if(!JsonFormat.isJSONValid(text)){ COptionPane.showMessageDialog(theTable.getEditorComponent(), INVALID_JSON_WARNING_MESSAGE, INVALID_JSON_TITLE, JOptionPane.WARNING_MESSAGE); return; } text = JsonFormat.getPrettyJson(text); }
-- ResultSetTablkeViewUtil > line #524
Please debug the code under, if (obj instanceof ResultsDiffValue) block. Few things are not looking right there.
if (value instanceof String) { text = ((ResultsDiffValue) obj).toString(); if(!JsonFormat.isJSONValid(text)){ COptionPane.showMessageDialog(theTable.getEditorComponent(), INVALID_JSON_WARNING_MESSAGE, INVALID_JSON_TITLE, JOptionPane.WARNING_MESSAGE); return; } text = JsonFormat.getPrettyJson(text); }
I added only this part
if(!JsonFormat.isJSONValid(text)){ COptionPane.showMessageDialog(theTable.getEditorComponent(), INVALID_JSON_WARNING_MESSAGE, INVALID_JSON_TITLE, JOptionPane.WARNING_MESSAGE); return; } text = JsonFormat.getPrettyJson(text);
Are you talking about this code?
@Bhagyashree,
I want you to figure out what that code does? What feature uses that code?
I added only this part
if(!JsonFormat.isJSONValid(text)){ COptionPane.showMessageDialog(theTable.getEditorComponent(), INVALID_JSON_WARNING_MESSAGE, INVALID_JSON_TITLE, JOptionPane.WARNING_MESSAGE); return; } text = JsonFormat.getPrettyJson(text);
Are you talking about this code?
@Bhagyashree,
I want you to figure out what that code does? What feature uses that code?
Hi Asif,
@Bhagyashree, I do not understand the context for the above explanation.
Hi Asif,
@Bhagyashree, I do not understand the context for the above explanation.
Revision #56050
> datastudio.iml
There are some new local module libraries added to this file. Please undo that change.
If you need new libraries, please contact me or any of the architects. We will have to review the usage.
Revision #56050
> datastudio.iml
There are some new local module libraries added to this file. Please undo that change.
If you need new libraries, please contact me or any of the architects. We will have to review the usage.
Hi Asif,
I need jackson-all-1.9.9.jar library to check if the string is valid json or not , Please refer JsonFormat class.
And one more change is there,
As you commented
-- ResultSetTablkeViewUtil > line #488
String text = obj.toString();
should be
String text = JsonFormat.getPrettyJson(obj);
This avoids converting to JSON string twice.
I kept it as it is, because in this case even if json is not valid , It was getting converted in pretty Json format.
Thanks,
Bhagyashree
@Bhagyashree,
>>I need jackson-all-1.9.9.jar library to check if the string is valid json or not
We already have jackson-core.jar v2.0.5 in our build path; I do not think we need to add any new library.
>>I kept it as it is, because in this case even if json is not valid , It was getting converted in pretty Json format.
Is JsonFormat.isJSONValid(text) method going to return true even for invalid json in pretty json format?
Hi Asif,
I need jackson-all-1.9.9.jar library to check if the string is valid json or not , Please refer JsonFormat class.
And one more change is there,
As you commented
-- ResultSetTablkeViewUtil > line #488
String text = obj.toString();
should be
String text = JsonFormat.getPrettyJson(obj);
This avoids converting to JSON string twice.
I kept it as it is, because in this case even if json is not valid , It was getting converted in pretty Json format.
Thanks,
Bhagyashree
@Bhagyashree,
>>I need jackson-all-1.9.9.jar library to check if the string is valid json or not
We already have jackson-core.jar v2.0.5 in our build path; I do not think we need to add any new library.
>>I kept it as it is, because in this case even if json is not valid , It was getting converted in pretty Json format.
Is JsonFormat.isJSONValid(text) method going to return true even for invalid json in pretty json format?
Update:
Had a call with Bhaghyashree. Based on Intellij CE 14.1.7, the JSON with syntax highlighting works. We should be able get that working too. Bhaghyashree is looking into it.
Update:
Had a call with Bhaghyashree. Based on Intellij CE 14.1.7, the JSON with syntax highlighting works. We should be able get that working too. Bhaghyashree is looking into it.
Hi Asif, Bhagyashree,
For QA testing purposes, what was the final decision on the editor? Should it have highlighting or not? I ran some tests and it still looks like a text editor.
Thanks, Tom
Hi Asif, Bhagyashree,
For QA testing purposes, what was the final decision on the editor? Should it have highlighting or not? I ran some tests and it still looks like a text editor.
Thanks, Tom
Also, I'm getting this in the console and log when there is invalid JSON. Can we suppress this?
Also, I'm getting this in the console and log when there is invalid JSON. Can we suppress this?
Stack trace problem is fixed and there will not be any highlighting.
Stack trace problem is fixed and there will not be any highlighting.
HI Tom
Highlighting (MIME type) Or JSON Editor support is not done.
As discussed on Tuesday call (25/sep/2018), Asif said he needs to investigate more on it and he also mentions MIME type does not impact current implementation,
@Asif, please Confirm
if you agree I will ask Juhi to create a ticket for MIME type and link with this issue.
Thanks,Pankaj
HI Tom
Highlighting (MIME type) Or JSON Editor support is not done.
As discussed on Tuesday call (25/sep/2018), Asif said he needs to investigate more on it and he also mentions MIME type does not impact current implementation,
@Asif, please Confirm
if you agree I will ask Juhi to create a ticket for MIME type and link with this issue.
Thanks,Pankaj
For allowing single quotes.
For allowing single quotes.
Hi Asif,
After applying patch, It is not giving "Not valid Json" popup for non-json values(see here)
Regards,
Bhagyashree kadam
[asif] Please provide the steps to reproduce the issue.
Hi Asif,
After applying patch, It is not giving "Not valid Json" popup for non-json values(see here)
Regards,
Bhagyashree kadam
[asif] Please provide the steps to reproduce the issue.
Hi Asif,
After applying patch, It is not giving "Not valid Json" popup for non-json values. --Fixed the issue
Thanks,
Bhagyashree
[asif] Thanks for the update.
Hi Asif,
After applying patch, It is not giving "Not valid Json" popup for non-json values. --Fixed the issue
Thanks,
Bhagyashree
[asif] Thanks for the update.
@bobfromtn
1) On right mouse of a grid result field, you could add "View in JSON viewer..." to the "View Cell in...". It would then be helpful to have the option in the JSON viewer either to automatically or on command "pretty format" the JSON. Collapsing JSON sections, outline of JSON or any more sophisticated view/edit features would be "nice to have".
As part of v19.5 release, we are addressing View/Edit as JSON only. We have created 2 separate issues for #2 & #3 and will be considered in a future release.
Thanks
@bobfromtn
1) On right mouse of a grid result field, you could add "View in JSON viewer..." to the "View Cell in...". It would then be helpful to have the option in the JSON viewer either to automatically or on command "pretty format" the JSON. Collapsing JSON sections, outline of JSON or any more sophisticated view/edit features would be "nice to have".
As part of v19.5 release, we are addressing View/Edit as JSON only. We have created 2 separate issues for #2 & #3 and will be considered in a future release.
Thanks
Test Cases:
1.In Grid Results right click on any column "View As Json" should be Added
2.When Clicked on "View As Json" it should open in Json view if it is json type
3. If its not Json type its should display error message
4.Right Click on any column Edit Json option should be added.
5.Once Clicked on Edit Json Edit window should get opened with json data inside it.
6.If it doesn't contain valid json then error message should get displayed.
7.Syntax highlighting should be supported.
8.In Results right click on any column "View as Json " field should get added.
9.When Clicked on "View As Json" it should open in Json view if it is json type
10.If its not Json type its should display error message.
Test Cases:
1.In Grid Results right click on any column "View As Json" should be Added
2.When Clicked on "View As Json" it should open in Json view if it is json type
3. If its not Json type its should display error message
4.Right Click on any column Edit Json option should be added.
5.Once Clicked on Edit Json Edit window should get opened with json data inside it.
6.If it doesn't contain valid json then error message should get displayed.
7.Syntax highlighting should be supported.
8.In Results right click on any column "View as Json " field should get added.
9.When Clicked on "View As Json" it should open in Json view if it is json type
10.If its not Json type its should display error message.
Issue #15380 |
Verified |
Fixed |
Resolved |
Completion |
No due date |
Fixed Build ADS19.5.0-dev-49 |
No time estimate |
2 issue links |
relates to #15630
Issue #15630Add support for JSON editor. |
relates to #15629
Issue #15629Results grid > Copy As > JSON |
Case #00632088
Ivan opened a case asking for the same thing, see below.
"Hello,
I am not able to find any way to edit single document of MongoDB in ADS.
Every other mongodb IDE has this simplest functionality (robomongo, studio3t).
What is needed
- Execute simple search db.testcollection.find({_id:123})
- Select document in results, edit json and save it back.
The only option to edit I found is: "Edit collection data (top 1000)", that is completely unusable.
It is not possible to apply query for this top 1000, most of the times IDE throws out of memory error, no way to edit document that is sorted after these 1000.
This is high prior issue.
Waiting for the fix on your side.
ADS details:
Licensed to The Goldman Sachs Group, Inc.
Enterprise License
Aqua Data Studio 18.0.18
Build #: 55109
Built on: 2017-Jul-12 02:09:22 PM"