You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Carsten Ziegeler (JIRA)" <ji...@apache.org> on 2018/11/11 09:49:00 UTC

[jira] [Commented] (SLING-7934) Add the ability for a resource to adapt to a JSONObject

    [ https://issues.apache.org/jira/browse/SLING-7934?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16682809#comment-16682809 ] 

Carsten Ziegeler commented on SLING-7934:
-----------------------------------------

I'm still a little bit struggling with how to use this. JsonObject is immutable, so any client code getting this JsonObject that wants to stream a different JSON structure than the one represented by the returned JsonObject needs to do quiet some complex manipulation to get a new JsonObject with the correct structure out of it. It's not possible to remove or add a property without creating a new JsonObject.
In that case creating a JsonObject out of a resource can as easily be done by adapting the resource to a value map, although value map does not support a hierarchy only a flat list of properties. Maybe that's the issue to fix?

> Add the ability for a resource to adapt to a JSONObject
> -------------------------------------------------------
>
>                 Key: SLING-7934
>                 URL: https://issues.apache.org/jira/browse/SLING-7934
>             Project: Sling
>          Issue Type: Improvement
>            Reporter: Jason E Bailey
>            Assignee: Jason E Bailey
>            Priority: Major
>
> There are multiple implementations all doing the same process of converting a resource to a JSONObject. If it's that common we should just add the ability to adapt the resource and centralize the implementation so that it's consistent.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)