Hi All,

This can be avoided by using "synapse.commons.json.buildValidNCNames" to
value "true" in <SERVER_HOME>/repository/conf/synapse.properties file, This
will replace space in the json to "JsonReader_32" value. So sample would be
as follows

input Json -
{
     "abc nnn": "value1"
}

output XML -
<abc_JsonReader_32_nnn>value1</abc_JsonReader_32_nnn>


And this works other way around as well, say you need to convert XML to
json and json element should need to have a space within it, then you can
use "JsonReader_32" in xml to get the space in json output, for example,

input xml -
<abc_JsonReader_32_nnn>value1</abc_JsonReader_32_nnn>

output json -
{
    "abc nnn": "value1"
}

I have added this info to jira as well,
@Praneesha, IMO better have it in docs as well.

Thanks,

On Thu, May 5, 2016 at 2:40 PM, Udara Liyanage <[email protected]> wrote:

> Hi,
>
> i think option 1 is better, As I remember earlier ESB versions uses
> underscore for space.
>
> On Thu, May 5, 2016 at 1:53 AM, Rajith Vitharana <[email protected]> wrote:
>
>> Hi,
>>
>> So what would be the best convention to follow
>> 1 - just throw a error saying can't convert to XML because of the space
>> character
>> 2 - encode that space (will need to support this when converting back to
>> json as well)
>>
>> Thanks,
>>
>> On Tue, Mar 8, 2016 at 9:37 AM, Udara Liyanage <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> Yes, I also think it is a bug in json to xml conversion. I will create a
>>> jira for this.
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [email protected]
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Rajith Vitharana
>>
>> Software Engineer,
>> WSO2 Inc. : wso2.com
>> Mobile : +94715883223
>> Blog : http://lankavitharana.blogspot.com/
>>
>
>
>
> --
>
> Udara Liyanage
> Software Engineer
> WSO2, Inc.: http://wso2.com
> lean. enterprise. middleware
>
> web: http://udaraliyanage.wordpress.com
> phone: +94 71 443 6897
>



-- 
Rajith Vitharana

Software Engineer,
WSO2 Inc. : wso2.com
Mobile : +94715883223
Blog : http://lankavitharana.blogspot.com/
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to