You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Tobias Bocanegra (JIRA)" <ji...@apache.org> on 2008/07/03 22:01:44 UTC

[jira] Created: (SLING-562) Pretty print the json dump

Pretty print the json dump
--------------------------

                 Key: SLING-562
                 URL: https://issues.apache.org/jira/browse/SLING-562
             Project: Sling
          Issue Type: Improvement
          Components: Commons JSON
    Affects Versions: Servlets Get 2.0.2, Commons JSON 2.0.2
            Reporter: Tobias Bocanegra
            Priority: Minor
         Attachments: json_tidy.r673772.patch

the current json exports are using the JSONWriter which writes a very compact for of json.
this is certainly good for performance, but a big pain when developping / debugging.
It would be cool if a 'pretty print' flag can be passed to the export that enables nice
formatted jsons. eg http://localhost/content/site/en.3.json?tidy=true

I patched the current JSONWriter and JsonItemWriter and added the respective flag to the servlet.

WDYT?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Created: (SLING-562) Pretty print the json dump

Posted by Dominik Süß <do...@gmail.com>.
Damn - forget about this.
Didn't realize it was a jira generated Mail and the discussion is in another
mailingthread.

Friday late @work.... SORRY

Dominik

On Fri, Jul 4, 2008 at 4:19 PM, Dominik Süß <do...@gmail.com> wrote:

> You shouldn't use a get-parameter for this.
> Since the prettyprintet json representation of the data is just another
> static view of the data you should use a selector like
> /content/site/en.3.tidy.json
> Avoid the usage of get-parameters wherever possible.
>
> Personally I'd not need this prettypring feature since json is no output
> I'd write out to the userinterface as plain text.
>
> Regards,
> Dominik
>
>
> On Thu, Jul 3, 2008 at 10:01 PM, Tobias Bocanegra (JIRA) <ji...@apache.org>
> wrote:
>
>> Pretty print the json dump
>> --------------------------
>>
>>                 Key: SLING-562
>>                 URL: https://issues.apache.org/jira/browse/SLING-562
>>             Project: Sling
>>          Issue Type: Improvement
>>          Components: Commons JSON
>>    Affects Versions: Servlets Get 2.0.2, Commons JSON 2.0.2
>>            Reporter: Tobias Bocanegra
>>            Priority: Minor
>>         Attachments: json_tidy.r673772.patch
>>
>> the current json exports are using the JSONWriter which writes a very
>> compact for of json.
>> this is certainly good for performance, but a big pain when developping /
>> debugging.
>> It would be cool if a 'pretty print' flag can be passed to the export that
>> enables nice
>> formatted jsons. eg http://localhost/content/site/en.3.json?tidy=true
>>
>> I patched the current JSONWriter and JsonItemWriter and added the
>> respective flag to the servlet.
>>
>> WDYT?
>>
>> --
>> This message is automatically generated by JIRA.
>> -
>> You can reply to this email to add a comment to the issue online.
>>
>>
>

Re: [jira] Created: (SLING-562) Pretty print the json dump

Posted by Dominik Süß <do...@gmail.com>.
You shouldn't use a get-parameter for this.
Since the prettyprintet json representation of the data is just another
static view of the data you should use a selector like
/content/site/en.3.tidy.json
Avoid the usage of get-parameters wherever possible.

Personally I'd not need this prettypring feature since json is no output I'd
write out to the userinterface as plain text.

Regards,
Dominik

On Thu, Jul 3, 2008 at 10:01 PM, Tobias Bocanegra (JIRA) <ji...@apache.org>
wrote:

> Pretty print the json dump
> --------------------------
>
>                 Key: SLING-562
>                 URL: https://issues.apache.org/jira/browse/SLING-562
>             Project: Sling
>          Issue Type: Improvement
>          Components: Commons JSON
>    Affects Versions: Servlets Get 2.0.2, Commons JSON 2.0.2
>            Reporter: Tobias Bocanegra
>            Priority: Minor
>         Attachments: json_tidy.r673772.patch
>
> the current json exports are using the JSONWriter which writes a very
> compact for of json.
> this is certainly good for performance, but a big pain when developping /
> debugging.
> It would be cool if a 'pretty print' flag can be passed to the export that
> enables nice
> formatted jsons. eg http://localhost/content/site/en.3.json?tidy=true
>
> I patched the current JSONWriter and JsonItemWriter and added the
> respective flag to the servlet.
>
> WDYT?
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>

[jira] Commented: (SLING-562) Pretty print the json dump

Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12618361#action_12618361 ] 

Bertrand Delacretaz commented on SLING-562:
-------------------------------------------

For now, I'll apply the patch but using a tidy selector instead of a request parameter

> Pretty print the json dump
> --------------------------
>
>                 Key: SLING-562
>                 URL: https://issues.apache.org/jira/browse/SLING-562
>             Project: Sling
>          Issue Type: Improvement
>          Components: Commons JSON
>    Affects Versions: Commons JSON 2.0.2, Servlets Get 2.0.2
>            Reporter: Tobias Bocanegra
>            Assignee: Bertrand Delacretaz
>            Priority: Minor
>         Attachments: json_tidy.r673772.patch
>
>
> the current json exports are using the JSONWriter which writes a very compact for of json.
> this is certainly good for performance, but a big pain when developping / debugging.
> It would be cool if a 'pretty print' flag can be passed to the export that enables nice
> formatted jsons. eg http://localhost/content/site/en.3.json?tidy=true
> I patched the current JSONWriter and JsonItemWriter and added the respective flag to the servlet.
> WDYT?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-562) Pretty print the json dump

Posted by "Roy T. Fielding (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12610336#action_12610336 ] 

Roy T. Fielding commented on SLING-562:
---------------------------------------

I think using segment parameters would be better, like

  http://localhost/content/site/en.3.json;tidy/more/path


> Pretty print the json dump
> --------------------------
>
>                 Key: SLING-562
>                 URL: https://issues.apache.org/jira/browse/SLING-562
>             Project: Sling
>          Issue Type: Improvement
>          Components: Commons JSON
>    Affects Versions: Commons JSON 2.0.2, Servlets Get 2.0.2
>            Reporter: Tobias Bocanegra
>            Priority: Minor
>         Attachments: json_tidy.r673772.patch
>
>
> the current json exports are using the JSONWriter which writes a very compact for of json.
> this is certainly good for performance, but a big pain when developping / debugging.
> It would be cool if a 'pretty print' flag can be passed to the export that enables nice
> formatted jsons. eg http://localhost/content/site/en.3.json?tidy=true
> I patched the current JSONWriter and JsonItemWriter and added the respective flag to the servlet.
> WDYT?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-562) Pretty print the json dump

Posted by "Roy T. Fielding (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12610354#action_12610354 ] 

Roy T. Fielding commented on SLING-562:
---------------------------------------

They are just a part of the URI path.  They are better for this purpose because they can be associated with each segment of the path and won't conflict with query processing or cache behavior.

Alternatively, just use a different extension for tidy-json. You are effectively requesting a different data format, so it might as well have its own extension.  Or you could define it like /em.3.tidy.json, where tidy is a filter that tidies up any number of formats.


> Pretty print the json dump
> --------------------------
>
>                 Key: SLING-562
>                 URL: https://issues.apache.org/jira/browse/SLING-562
>             Project: Sling
>          Issue Type: Improvement
>          Components: Commons JSON
>    Affects Versions: Commons JSON 2.0.2, Servlets Get 2.0.2
>            Reporter: Tobias Bocanegra
>            Priority: Minor
>         Attachments: json_tidy.r673772.patch
>
>
> the current json exports are using the JSONWriter which writes a very compact for of json.
> this is certainly good for performance, but a big pain when developping / debugging.
> It would be cool if a 'pretty print' flag can be passed to the export that enables nice
> formatted jsons. eg http://localhost/content/site/en.3.json?tidy=true
> I patched the current JSONWriter and JsonItemWriter and added the respective flag to the servlet.
> WDYT?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SLING-562) Pretty print the json dump

Posted by "Tobias Bocanegra (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-562?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tobias Bocanegra updated SLING-562:
-----------------------------------

    Attachment: json_tidy.r673772.patch

> Pretty print the json dump
> --------------------------
>
>                 Key: SLING-562
>                 URL: https://issues.apache.org/jira/browse/SLING-562
>             Project: Sling
>          Issue Type: Improvement
>          Components: Commons JSON
>    Affects Versions: Commons JSON 2.0.2, Servlets Get 2.0.2
>            Reporter: Tobias Bocanegra
>            Priority: Minor
>         Attachments: json_tidy.r673772.patch
>
>
> the current json exports are using the JSONWriter which writes a very compact for of json.
> this is certainly good for performance, but a big pain when developping / debugging.
> It would be cool if a 'pretty print' flag can be passed to the export that enables nice
> formatted jsons. eg http://localhost/content/site/en.3.json?tidy=true
> I patched the current JSONWriter and JsonItemWriter and added the respective flag to the servlet.
> WDYT?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-562) Pretty print the json dump

Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12610474#action_12610474 ] 

Carsten Ziegeler commented on SLING-562:
----------------------------------------

Yes, I guess it would be great to have both :)

> Pretty print the json dump
> --------------------------
>
>                 Key: SLING-562
>                 URL: https://issues.apache.org/jira/browse/SLING-562
>             Project: Sling
>          Issue Type: Improvement
>          Components: Commons JSON
>    Affects Versions: Commons JSON 2.0.2, Servlets Get 2.0.2
>            Reporter: Tobias Bocanegra
>            Priority: Minor
>         Attachments: json_tidy.r673772.patch
>
>
> the current json exports are using the JSONWriter which writes a very compact for of json.
> this is certainly good for performance, but a big pain when developping / debugging.
> It would be cool if a 'pretty print' flag can be passed to the export that enables nice
> formatted jsons. eg http://localhost/content/site/en.3.json?tidy=true
> I patched the current JSONWriter and JsonItemWriter and added the respective flag to the servlet.
> WDYT?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (SLING-562) Pretty print the json dump

Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-562?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bertrand Delacretaz reassigned SLING-562:
-----------------------------------------

    Assignee: Bertrand Delacretaz

> Pretty print the json dump
> --------------------------
>
>                 Key: SLING-562
>                 URL: https://issues.apache.org/jira/browse/SLING-562
>             Project: Sling
>          Issue Type: Improvement
>          Components: Commons JSON
>    Affects Versions: Commons JSON 2.0.2, Servlets Get 2.0.2
>            Reporter: Tobias Bocanegra
>            Assignee: Bertrand Delacretaz
>            Priority: Minor
>         Attachments: json_tidy.r673772.patch
>
>
> the current json exports are using the JSONWriter which writes a very compact for of json.
> this is certainly good for performance, but a big pain when developping / debugging.
> It would be cool if a 'pretty print' flag can be passed to the export that enables nice
> formatted jsons. eg http://localhost/content/site/en.3.json?tidy=true
> I patched the current JSONWriter and JsonItemWriter and added the respective flag to the servlet.
> WDYT?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-562) Pretty print the json dump

Posted by "Tobias Bocanegra (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12610337#action_12610337 ] 

Tobias Bocanegra commented on SLING-562:
----------------------------------------

roy, can you clarify the intention of segment parameters?



> Pretty print the json dump
> --------------------------
>
>                 Key: SLING-562
>                 URL: https://issues.apache.org/jira/browse/SLING-562
>             Project: Sling
>          Issue Type: Improvement
>          Components: Commons JSON
>    Affects Versions: Commons JSON 2.0.2, Servlets Get 2.0.2
>            Reporter: Tobias Bocanegra
>            Priority: Minor
>         Attachments: json_tidy.r673772.patch
>
>
> the current json exports are using the JSONWriter which writes a very compact for of json.
> this is certainly good for performance, but a big pain when developping / debugging.
> It would be cool if a 'pretty print' flag can be passed to the export that enables nice
> formatted jsons. eg http://localhost/content/site/en.3.json?tidy=true
> I patched the current JSONWriter and JsonItemWriter and added the respective flag to the servlet.
> WDYT?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-562) Pretty print the json dump

Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12610461#action_12610461 ] 

Carsten Ziegeler commented on SLING-562:
----------------------------------------

What about making this a configuration of the json renderer? Now, while it is more correct to use a different uri to address the pretty printed json, it's not that ideal for development. My application uses "something.json" all over the place - changing all these links to the pretty printed version, would mean i've to change my whole app code.
If it's just a configuration value, I get the pretty printed json without any further changes and can switch back later on easily.

> Pretty print the json dump
> --------------------------
>
>                 Key: SLING-562
>                 URL: https://issues.apache.org/jira/browse/SLING-562
>             Project: Sling
>          Issue Type: Improvement
>          Components: Commons JSON
>    Affects Versions: Commons JSON 2.0.2, Servlets Get 2.0.2
>            Reporter: Tobias Bocanegra
>            Priority: Minor
>         Attachments: json_tidy.r673772.patch
>
>
> the current json exports are using the JSONWriter which writes a very compact for of json.
> this is certainly good for performance, but a big pain when developping / debugging.
> It would be cool if a 'pretty print' flag can be passed to the export that enables nice
> formatted jsons. eg http://localhost/content/site/en.3.json?tidy=true
> I patched the current JSONWriter and JsonItemWriter and added the respective flag to the servlet.
> WDYT?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-562) Pretty print the json dump

Posted by "Tobias Bocanegra (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12610473#action_12610473 ] 

Tobias Bocanegra commented on SLING-562:
----------------------------------------

configuring the output is of course another option, and might be better when monitoring network traffic. my intention was that you would issue the request manually in the browser anyways, so adding an extra parameter is no problem.

> Pretty print the json dump
> --------------------------
>
>                 Key: SLING-562
>                 URL: https://issues.apache.org/jira/browse/SLING-562
>             Project: Sling
>          Issue Type: Improvement
>          Components: Commons JSON
>    Affects Versions: Commons JSON 2.0.2, Servlets Get 2.0.2
>            Reporter: Tobias Bocanegra
>            Priority: Minor
>         Attachments: json_tidy.r673772.patch
>
>
> the current json exports are using the JSONWriter which writes a very compact for of json.
> this is certainly good for performance, but a big pain when developping / debugging.
> It would be cool if a 'pretty print' flag can be passed to the export that enables nice
> formatted jsons. eg http://localhost/content/site/en.3.json?tidy=true
> I patched the current JSONWriter and JsonItemWriter and added the respective flag to the servlet.
> WDYT?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SLING-562) Pretty print the json dump

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-562?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger updated SLING-562:
------------------------------------

    Fix Version/s: Commons JSON 2.0.4

> Pretty print the json dump
> --------------------------
>
>                 Key: SLING-562
>                 URL: https://issues.apache.org/jira/browse/SLING-562
>             Project: Sling
>          Issue Type: Improvement
>          Components: Commons JSON
>    Affects Versions: Commons JSON 2.0.2, Servlets Get 2.0.2
>            Reporter: Tobias Bocanegra
>            Assignee: Bertrand Delacretaz
>            Priority: Minor
>             Fix For: Commons JSON 2.0.4
>
>         Attachments: json_tidy.r673772.patch
>
>
> the current json exports are using the JSONWriter which writes a very compact for of json.
> this is certainly good for performance, but a big pain when developping / debugging.
> It would be cool if a 'pretty print' flag can be passed to the export that enables nice
> formatted jsons. eg http://localhost/content/site/en.3.json?tidy=true
> I patched the current JSONWriter and JsonItemWriter and added the respective flag to the servlet.
> WDYT?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (SLING-562) Pretty print the json dump

Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-562?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bertrand Delacretaz resolved SLING-562.
---------------------------------------

    Resolution: Fixed

Patch committed in revision 681080 with some changes to use the tidy selector instead of a request parameter.

Examples URLs:

http://localhost:8888/sling-logo.png.tidy.infinity.json
http://localhost:8888/sling-logo.png.tidy.json
http://localhost:8888/sling-logo.png.infinity.json
http://localhost:8888/sling-logo.png.json

See also the tests at the end of  http://svn.eu.apache.org/repos/asf/incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/JsonRenderingTest.java

Please cross-check and close this issue, and maybe open another one to configure the tidy format as the default.

> Pretty print the json dump
> --------------------------
>
>                 Key: SLING-562
>                 URL: https://issues.apache.org/jira/browse/SLING-562
>             Project: Sling
>          Issue Type: Improvement
>          Components: Commons JSON
>    Affects Versions: Commons JSON 2.0.2, Servlets Get 2.0.2
>            Reporter: Tobias Bocanegra
>            Assignee: Bertrand Delacretaz
>            Priority: Minor
>         Attachments: json_tidy.r673772.patch
>
>
> the current json exports are using the JSONWriter which writes a very compact for of json.
> this is certainly good for performance, but a big pain when developping / debugging.
> It would be cool if a 'pretty print' flag can be passed to the export that enables nice
> formatted jsons. eg http://localhost/content/site/en.3.json?tidy=true
> I patched the current JSONWriter and JsonItemWriter and added the respective flag to the servlet.
> WDYT?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.