You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Praveer Gupta (JIRA)" <ji...@apache.org> on 2011/04/27 06:43:03 UTC
[jira] [Created] (CXF-3475) JSONProvider not able to unmarshall
JSON string without namespaces
JSONProvider not able to unmarshall JSON string without namespaces
------------------------------------------------------------------
Key: CXF-3475
URL: https://issues.apache.org/jira/browse/CXF-3475
Project: CXF
Issue Type: Bug
Components: JAX-RS, JAXB Databinding
Affects Versions: 2.4
Reporter: Praveer Gupta
If a JSON String is generated by org.apache.cxf.jaxrs.provider.JSONProvider using the attributes ignoreNamespaces and attributesToElements as true, the JSONProvider is not able to unmarshall the same JSON string back to the Java object from which it was generated.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CXF-3475) JSONProvider not able to unmarshall
JSON string without namespaces
Posted by "Praveer Gupta (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-3475?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13025895#comment-13025895 ]
Praveer Gupta commented on CXF-3475:
------------------------------------
How should the map be provided to the inTransformElements when there are more than one namespaces in the JSON output that had been removed.
For example: consider the JSON String {"book.book":{"book.element1":"value1", "book.element2":{"name.element3":"value3"}}}.
In the above case there are two namespaces, 'book' and 'name'.
If ignoreNamespaces is true, the output becomes {"book":{"element1":"value1", "element2":{"element3":"value3"}}}
Map has to be provided to the inTransformElements for both 'book' and 'name'. According to me, for both these namespaces the key becomes "", which doesn't make sense.
Eg:
<property name="inTransformElements" >
<map>
<entry key="" value="book" />
<entry key="" value="name" />
</map>
</property>
Is there some other way this has to be configured.
> JSONProvider not able to unmarshall JSON string without namespaces
> ------------------------------------------------------------------
>
> Key: CXF-3475
> URL: https://issues.apache.org/jira/browse/CXF-3475
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS, JAXB Databinding
> Affects Versions: 2.4
> Reporter: Praveer Gupta
> Assignee: Sergey Beryozkin
>
> If a JSON String is generated by org.apache.cxf.jaxrs.provider.JSONProvider using the attributes ignoreNamespaces and attributesToElements as true, the JSONProvider is not able to unmarshall the same JSON string back to the Java object from which it was generated.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (CXF-3475) JSONProvider not able to unmarshall
JSON string without namespaces
Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-3475?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sergey Beryozkin resolved CXF-3475.
-----------------------------------
Resolution: Not A Problem
Assignee: Sergey Beryozkin
This is a configuration issue for receiving JSONProvider.
Elements can not be converted back to attributes for JSON sequences, only for XML sequences (with XSLTJaxbProvider or similar)
> JSONProvider not able to unmarshall JSON string without namespaces
> ------------------------------------------------------------------
>
> Key: CXF-3475
> URL: https://issues.apache.org/jira/browse/CXF-3475
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS, JAXB Databinding
> Affects Versions: 2.4
> Reporter: Praveer Gupta
> Assignee: Sergey Beryozkin
>
> If a JSON String is generated by org.apache.cxf.jaxrs.provider.JSONProvider using the attributes ignoreNamespaces and attributesToElements as true, the JSONProvider is not able to unmarshall the same JSON string back to the Java object from which it was generated.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CXF-3475) JSONProvider not able to unmarshall
JSON string without namespaces
Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-3475?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13025670#comment-13025670 ]
Sergey Beryozkin commented on CXF-3475:
---------------------------------------
If you strip the namespaces off and expect to read the sequence into a JAXB bean then you'll have to configure JSONProvider on the receiving end to append the namespaces, using inTransformElements,
* : {mynamespace}*
or
book : {mynamespace}book
name : {mynamespace}name
However you can't convert attributes to elements and then expect those elements treated as attributes on the receiving end - that may work for XML sequences but not for JSON sequences
> JSONProvider not able to unmarshall JSON string without namespaces
> ------------------------------------------------------------------
>
> Key: CXF-3475
> URL: https://issues.apache.org/jira/browse/CXF-3475
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS, JAXB Databinding
> Affects Versions: 2.4
> Reporter: Praveer Gupta
>
> If a JSON String is generated by org.apache.cxf.jaxrs.provider.JSONProvider using the attributes ignoreNamespaces and attributesToElements as true, the JSONProvider is not able to unmarshall the same JSON string back to the Java object from which it was generated.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Issue Comment Edited] (CXF-3475) JSONProvider not able to
unmarshall JSON string without namespaces
Posted by "Praveer Gupta (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-3475?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13025895#comment-13025895 ]
Praveer Gupta edited comment on CXF-3475 at 4/27/11 4:57 PM:
-------------------------------------------------------------
How should the map be provided to the inTransformElements when there are more than one namespaces in the JSON output that had been removed.
For example: consider the JSON String {"book.book":{"book.element1":"value1", "book.element2":{"name.element3":"value3"}}}.
In the above case there are two namespaces, 'book' and 'name'.
If ignoreNamespaces is true, the output becomes {"book":{"element1":"value1", "element2":{"element3":"value3"}}}
Map has to be provided to the inTransformElements for both 'book' and 'name'. According to me, for both these namespaces the key becomes "", which doesn't make sense.
Eg:
<property name="inTransformElements" >
<map>
<entry key="" value="book" />
<entry key="" value="name" />
</map>
</property>
Is there some other way this has to be configured (the above configuration doesn't work).
was (Author: praveer09):
How should the map be provided to the inTransformElements when there are more than one namespaces in the JSON output that had been removed.
For example: consider the JSON String {"book.book":{"book.element1":"value1", "book.element2":{"name.element3":"value3"}}}.
In the above case there are two namespaces, 'book' and 'name'.
If ignoreNamespaces is true, the output becomes {"book":{"element1":"value1", "element2":{"element3":"value3"}}}
Map has to be provided to the inTransformElements for both 'book' and 'name'. According to me, for both these namespaces the key becomes "", which doesn't make sense.
Eg:
<property name="inTransformElements" >
<map>
<entry key="" value="book" />
<entry key="" value="name" />
</map>
</property>
Is there some other way this has to be configured.
> JSONProvider not able to unmarshall JSON string without namespaces
> ------------------------------------------------------------------
>
> Key: CXF-3475
> URL: https://issues.apache.org/jira/browse/CXF-3475
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS, JAXB Databinding
> Affects Versions: 2.4
> Reporter: Praveer Gupta
> Assignee: Sergey Beryozkin
>
> If a JSON String is generated by org.apache.cxf.jaxrs.provider.JSONProvider using the attributes ignoreNamespaces and attributesToElements as true, the JSONProvider is not able to unmarshall the same JSON string back to the Java object from which it was generated.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CXF-3475) JSONProvider not able to unmarshall
JSON string without namespaces
Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CXF-3475?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13026028#comment-13026028 ]
Sergey Beryozkin commented on CXF-3475:
---------------------------------------
<property name="inTransformElements" >
<map>
<entry key="book" value="{http://books}book" />
<entry key="name" value="{http://names}name" />
</map>
</property>
see the docs please, key is the incoming element, value is how it should be transformed
> JSONProvider not able to unmarshall JSON string without namespaces
> ------------------------------------------------------------------
>
> Key: CXF-3475
> URL: https://issues.apache.org/jira/browse/CXF-3475
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS, JAXB Databinding
> Affects Versions: 2.4
> Reporter: Praveer Gupta
> Assignee: Sergey Beryozkin
>
> If a JSON String is generated by org.apache.cxf.jaxrs.provider.JSONProvider using the attributes ignoreNamespaces and attributesToElements as true, the JSONProvider is not able to unmarshall the same JSON string back to the Java object from which it was generated.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira